call LUa from string rather than file
say u have a string a="add(1,2)"
how would u call that to a LUA . rather than a txt file
in a txt file it wa lua_dofile(name);
hwo do u do this for a string vaiable?
A quick flick through lauxlib.h showed up this:
That's probably what you want.
[edit]And if you want a value returned from lua, you'll probably have to pop it off the stack, or plonk it in a global variable and then grab it out of the global environment table, lua_dostring will not return it directly[/edit]
LUALIB_API int lua_dostring (lua_State *L, const char *str);
That's probably what you want.
[edit]And if you want a value returned from lua, you'll probably have to pop it off the stack, or plonk it in a global variable and then grab it out of the global environment table, lua_dostring will not return it directly[/edit]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement