Jump to content

lua methods in C++


Rick
 Share

Recommended Posts

So in some C++ examples I notice it uses some lua methods without having to include any lua stuff. But when I try some other lua methods they aren't recognized. Why would that be? For example I tried lua_register() to register a function for lua to be able to call, but I get the error: 'lua_register': identifier not found. I assume this lua methods you are using below and work without including any lua stuff are the actual lua methods and not a copy of the methods that Josh made?

 

BP L = GetLuaState();
lua_pushobject(L, framework);
lua_setglobal(L, "fw");
lua_pop(L, 1);

Link to comment
Share on other sites

Now with what I'm seeing I have to wonder. It seems like lua_setglobal(L, "fw") and lua_pop(L, 1) are something Josh created and aren't the normal lua methods (even though they are sharing the same name)? Can anyone confirm this because if so this really screws up using normal lua methods. The fact that these methods are the same name as normal lua methods but those lua methods are expecting lua_State* as the first parameter and when we pass BP it works, leads me to believe these are Josh's functions and not the normal lua functions.

 

The issue this seems to cause is that when I include lua in my project it doesn't like me passing BP to those methods. So if I cast them to (lua_State*) I don't get compile errors but then things don't seem to function right because the underlying LE method must be doing something else.

 

Basically when including lua in a LE project and LE having the same function names are lua function, all hell breaks loose because it doesn't know which function you want to use. A simple rename of the LE lua methods would solve this and should probably be different anyway. No sense in confusing people that are linking in lua by having the same function name.

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