Commit d618441e authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

Update README.md

parent f77daf85
......@@ -145,12 +145,12 @@ Passing .NET objects to the state:
```csharp
SomeClass obj = new SomeClass ("Param");
state ["obj"] = obj; // Create a global value 'obj' of .NET type SomeClass
-- This could be any .NET object, from BCL or from your assemblies
// This could be any .NET object, from BCL or from your assemblies
```
Using .NET assemblies inside Lua:
To acccess any .NET assembly to create objects, events etc inside Lua you need to ask NLua to use CLR as a Lua package.
To access any .NET assembly to create objects, events etc inside Lua you need to ask NLua to use CLR as a Lua package.
To do this just use the method `LoadCLRPackage` and use the `import` function inside your Lua script to load the Assembly.
```csharp
......@@ -160,6 +160,16 @@ To do this just use the method `LoadCLRPackage` and use the `import` function in
// import will load any .NET assembly and they will be available inside the Lua context.
```
Creating .NET objects:
To create object you only need to use the class name with the `()`.
```csharp
state.DoString (@"
obj2 = SomeClass() -- you can suppress default values.
client = WebClient()
");
```
Calling instance methods:
To call instance methods you need to use the `:` notation, you can call methods from objects passed to Lua or to objects created inside the Lua context.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment