Davaris Posted September 4, 2010 Share Posted September 4, 2010 I was wondering, can we call C# functions from Lua scripts? If so are there any examples or tutorials showing how to do this? Quote Win 7 Pro 64 bit AMD Phenom II X3 720 2.8GHz GeForce 9800 GTX/9800 GTX+ 4 GB RAM Link to comment Share on other sites More sharing options...
Rick Posted September 4, 2010 Share Posted September 4, 2010 This might help. http://www.gamedev.net/reference/articles/article2275.asp I'm sure you'll need a 3rd party library. Quote Link to comment Share on other sites More sharing options...
Davaris Posted September 5, 2010 Author Share Posted September 5, 2010 This might help. http://www.gamedev.net/reference/articles/article2275.asp I'm sure you'll need a 3rd party library. I tried that one last night. I was hoping it would get me to the stage of compiling and running Lua scripts, but by the end of the tute, you only end up with a console to type commands into. It occurred to me this morning that you probably can't integrate your own libraries into Lua with the Editor, without having access to the source code, as I assume you need to compile everything together. Or perhaps I don't understand it correctly? Anyway it would be really nice if I could call my own C# or C++ libraries from the Lua in the LWs Editor. Quote Win 7 Pro 64 bit AMD Phenom II X3 720 2.8GHz GeForce 9800 GTX/9800 GTX+ 4 GB RAM Link to comment Share on other sites More sharing options...
Rick Posted September 5, 2010 Share Posted September 5, 2010 You can. I wrote something on the old forum on how to load a DLL from Lua and call C/C++ functions from it. Quote Link to comment Share on other sites More sharing options...
Davaris Posted September 6, 2010 Author Share Posted September 6, 2010 Thanks I found your post here. Calling C++ functions from Sandbox LUA script http://leadwerks.com/werkspace/index.php?/topic/208-calling-c-functions-from-sandbox-lua-script/ What I was not sure about, is there are a couple of flavors to chose from, so I didn't know if they would be compatible. Case in point, Josh was saying they were thinking about using Luabind here: http://leadwerks.com/werkspace/index.php?/blog/1/entry-189-picking-up-speed/ What I'm thinking would be better in my case, is to add the third party libraries to the C# or C++ part of my engine and use something like this to get the needed data: LUA GetKey, SetKey - How to use? http://leadwerks.com/werkspace/index.php?/topic/277-lua-getkey-setkey-how-to-use/ The thread is pretty old now, so I don't know if it is still done this way in LWs. Quote Win 7 Pro 64 bit AMD Phenom II X3 720 2.8GHz GeForce 9800 GTX/9800 GTX+ 4 GB RAM Link to comment Share on other sites More sharing options...
ZioRed Posted September 6, 2010 Share Posted September 6, 2010 GetKey/SetKey are still methods of every object: object:SetKey(key,value) object:GetKey(key,value) They are declared in class.lua Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.