lua - Instance of C# class with NLua -
i'm trying create instance of c# class within lua file using nlua
here's code.
class program { public static void main (string[] args) { lua lua = new lua(); lua.loadclrpackage(); lua.dostring(@" import ('luatest.exe', 'luatest') test = test() "); } } public class test { public test() { console.writeline("it worked"); } }
but doesn't seem work, i've looked around , tried number of different ways. error ways i've tried this:
an unhandled exception of type 'nlua.exceptions.luascriptexception' occurred in nlua.dll additional information: [string "chunk"]:3: attempt call global 'test' (a nil value)
it's bit odd because straight out of example code? https://github.com/nlua/nlua
thanks guys.
bit of rant:
if i'm doing incredably wrong please let me know. on side note i'm using pure c# build, not sure if makes difference here or not, didn't see warnings it? whole thing seems undocumented...
if has suggestions better pure c# lua library i'm ears.
i sorry that. readme file wrong.
just remove ".exe" , shuold work fine
class program { public static void main (string[] args) { lua lua = new lua(); lua.loadclrpackage(); lua.dostring(@" import ('luatest', 'luatest') test = test() "); } } public class test { public test() { console.writeline("it worked"); } }
i've fixed readme github.com/nlua/nlua
Comments
Post a Comment