Rick Posted April 16, 2015 Share Posted April 16, 2015 I have the below code and when I'm looking at the App table it works just fine. It loops over the functions perfectly. However, when I put in the name of an entity script it bombs on lua_next() with access violation. What is different about the App table vs the entity script Tables that get created? Is there a way to get the instances of entity scripts from it's filename (if I recall the name of the lua file is what the table gets created with). I'm working with NoesisGUI and working on making a codebehind file that is in Lua. The plan is that we'll have load a xaml file from NoesisGUI. The base name of that xaml file will be the same name as a lua entity script file. The user will attach the script to a pivot and inside define their event functions. In the LE C++ project I'll get that entity script table and loop over all it's functions looking for a prefix that tells me it's a NoesisGUI event callback. The format will be: function Noesis_ControlNameInXamlFile_Event() end When I see a function start with Noesis I then get the control name and find that Noesis control, and then find the event name (Noesis has a way to get event delegates via it's string name) and bind the event to a generic C++ event. When Noesis calls this generic event inside of it I'll concat the Lua function name and call it for said Lua table. I'm packaging all this up into 1 nice and easy C++ library so users just have to call a few functions in their C++ LE project and everything is handled for them. However, not sure how to get lua entity script tables in C++. Anyone have any ideas? [EDIT] OK, decided to just make normal Lua "static classes" to handle this. But would still be interested to know if we can get entity script tables from C++. Quote Link to comment Share on other sites More sharing options...
Skrakle Posted April 18, 2015 Share Posted April 18, 2015 This may be what you're looking for, it's an example of lua table retrieval to c++: http://lua-users.org/lists/lua-l/2004-04/msg00201.html EDIT: Sorry i just realized that script variables aren't accessible in c++, i haven't found anything that would do it, perhaps it must be done from the engine. Quote 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.