state [<spanclass="pl-s1"><spanclass="pl-pds">"</span>obj<spanclass="pl-pds">"</span></span>] = obj; <spanclass="pl-c">// Create a global value 'obj' of .NET type SomeClass </span>
state [<spanclass="pl-s1"><spanclass="pl-pds">"</span>obj<spanclass="pl-pds">"</span></span>] = obj; <spanclass="pl-c">// Create a global value 'obj' of .NET type SomeClass </span>
-- This could be any .NET <spanclass="pl-st">object</span>, <spanclass="pl-k">from</span> BCL or <spanclass="pl-k">from</span> your assemblies</pre></div>
<spanclass="pl-c">// This could be any .NET object, from BCL or from your assemblies</span></pre></div>
<p>Using .NET assemblies inside Lua:</p>
<p>Using .NET assemblies inside Lua:</p>
<p>To acccess any .NET assembly to create objects, events etc inside Lua you need to ask NLua to use CLR as a Lua package.
<p>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 <code>LoadCLRPackage</code> and use the <code>import</code> function inside your Lua script to load the Assembly.</p>
To do this just use the method <code>LoadCLRPackage</code> and use the <code>import</code> function inside your Lua script to load the Assembly.</p>
To call instance methods you need to use the <code>:</code> notation, you can call methods from objects passed to Lua or to objects created inside the Lua context.</p>
To call instance methods you need to use the <code>:</code> notation, you can call methods from objects passed to Lua or to objects created inside the Lua context.</p>
...
@@ -219,7 +227,7 @@ To call instance methods you need to use the <code>:</code> notation, you can ca
...
@@ -219,7 +227,7 @@ To call instance methods you need to use the <code>:</code> notation, you can ca
You can call static methods using only the class name and the <code>.</code> notation from Lua.</p>
You can call static methods using only the class name and the <code>.</code> notation from Lua.</p>
@@ -231,10 +239,10 @@ You can get (or set) any property using <code>.</code> notation from Lua.</p>
...
@@ -231,10 +239,10 @@ You can get (or set) any property using <code>.</code> notation from Lua.</p>
<p>All methods, events or property need to be public available, NLua will fail to call non-public members.</p>
<p>All methods, events or property need to be public available, NLua will fail to call non-public members.</p>
<p>If you are using Xamarin.iOS you need to <ahref="http://developer.xamarin.com/guides/ios/advanced_topics/linker/"><code>Preserve</code></a> the class you wan't use inside NLua, otherwise the Linker will remove the class from final binary if the class is not in use.</p>
<p>If you are using Xamarin.iOS you need to <ahref="http://developer.xamarin.com/guides/ios/advanced_topics/linker/"><code>Preserve</code></a> the class you want to use inside NLua, otherwise the Linker will remove the class from final binary if the class is not in use.</p>