🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

call LUa from string rather than file

Started by
0 comments, last by Monder 19 years, 11 months ago
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?
Advertisement
A quick flick through lauxlib.h showed up this:

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