Jump to content

Looping over an entity script functions in C++


Rick
 Share

Recommended Posts

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++.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...