lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi !
I must call my LuaObjects with an "this" statement
but i can call declared functions via lua_pushcclosure()
unless this, now i will that my static
function returns
an value
or string, that works not so how in LuaObjectCallback
what i must
do , so my MyPrint returns a value to Luascript?
very thanks
for read me !
Karsten Schulz Berlin

In my C++ i declare an static function
---------------------------------------------
static int MyPrint(lua_State *lua)
{
printf("%s",lua_tostring(lua, 1));
//->dont work so-> lua_pushstring (lua, "AnswerText");
return 0;
}

//and declare the function
lua_pushcclosure (m_pState, MyPrint, 0);
lua_setglobal (m_pState, "MyPrint");
---------------------------------------------


In
my Lua, i call the function
----------------------------------------------
v = trace ("start\r\n")
print("MyPrint return:",v);
---------------------------------------------
No return value i can get