Passing a string as a tabe index via c++
I was wondering if its possible to do somthing to this affect
string Look_Up(sting Name)
{
lua_State* Lua;
Lua = lua_open();
lua_baselibopen(Lua);
lua_getglobal(Lua, "Look_Up");
lua_pushstring(Name);//not an actual function
lua_call(Lua,1,1);
sting Path = lua_tostring(Lua, -1);
lua_pop(Lua,1);
delete Lua;
return Path;
}
push string is not an actual function so how would I go about passing one into a lua function?
thx =)
[Edited by - raptorstrike on July 15, 2005 10:48:57 AM]
lua_pushstring is an actual function.
void lua_pushstring (lua_State *L, const char *s);
http://www.lua.org/pil/24.2.1.html
void lua_pushstring (lua_State *L, const char *s);
http://www.lua.org/pil/24.2.1.html
I am not sure I fully understand your question, but if it was I think it is, then all you need to do is:
std:string s;
lua_pushstring(L, s.c_str());
Is that what you want? Or do you want the std::string object placed into lua as a separate lua table with metatable methods that would make it emulate the c++ std::string class?
std:string s;
lua_pushstring(L, s.c_str());
Is that what you want? Or do you want the std::string object placed into lua as a separate lua table with metatable methods that would make it emulate the c++ std::string class?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement