Advertisement

Lua: lua_dostring, loadstring, lua_load, etc

Started by March 18, 2004 03:07 PM
2 comments, last by Kylotan 20 years, 8 months ago
I think this was covered before, but it came up again today when I was talking about recompiling code from a string: Lua 4.0 has a function called lua_dostring() which executes a string, treating it as Lua code. Lua 5.0 mentions (near the bottom of the manual) that ''dostring is deprecated. Use loadstring instead''. But there is no loadstring (or lua_loadstring) in the C API. I''m assuming you use lua_load() and that the mention of loadstring in the manual was just a mix-up. lauxlib.h provides lua_dostring() in the Compatibility section so I assume you can still use that anyway, it seems. Does anybody know if my theory is right though? [ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
The mention in the manual about loadstring refers to Lua code.

You should use lua_load instead of lua_dostring in C code.
Advertisement
Yeah, that would make sense, except that it''s a bit nonsensical to say that a Lua function can make a C API function deprecated. Oh well.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
I''m told there''s a luaL_dobuffer (or something, note the "L" utility function, but I haven''t checked this out yet.

This topic is closed to new replies.

Advertisement