I want to use Nlua in my Project. My project setup is: I have a shared project where I implemented my logic, and several platform specific projects that use this shared project.
I now want to use classes defined in this shared project inside a lua function I execute with Nlua. Problem is, this doesn't work.
lua.DoString(@"import('Platformspecific_Project_AssemblyName', 'Platformspecific_Project_Namespace') SomceClass.StaticMethod()");
This works fine. But if I now want to use a class defined in the shared project, this won't work:
lua.DoString(@"import('Platformspecific_Project_Assembly','Shared_Project_Namespace') SomeSharedClass.StaticMethod()");
The error I get is:
Additional information: [string "chunk"]:1: attempt to index global 'SomeSharedClass' (a nil value)
From what I read (I'm new to lua by the way) this error occurs if I want to do something to a variable before it is defined (because lua files are parsed from start to the end, though I'm not shure about this.)
My question is: How can I use Methods and Classes defined in a shared project with Nlua? I'm pretty shure I got something wrong with Assemblies, but it seems there's not much documentation on this topic.
Any help is appreciated!
Share project doesn't create an Assembly (.dll), you need to use the final Assembly.
Or you could use a PCL as well 😉. Otherwise the LoadAssembly
from NLua will fail
Thank you.