示例#1
0
LuaObject LuaState::GetLocalByName( int level, const char* name )
{
	lua_State * L = GetCState();
	lua_Debug ar;
	int i;
	const char *localName;
	if (lua_getstack(L, level, &ar) == 0)
		return LuaObject(this);  /* failure: no such level in the stack */
	i = 1;
	while ((localName = lua_getlocal(L, &ar, i++)) != NULL) {
		if (strcmp(name, localName) == 0)
		{
			LuaObject obj(this, -1);
			lua_pop(L, 1);
			return obj;
		}
		lua_pop(L, 1);  /* remove variable value */
	}
	return LuaObject(this);
}
示例#2
0
LuaObject LuaState::CreateThread(LuaState* parentState)
{
    lua_State* L1 = lua_newthread(parentState->GetCState());
    lua_TValue tobject;
    setnilvalue2n(L1, &tobject);
    setthvalue(parentState->GetCState(), &tobject, L1);

	LuaObject retObj = LuaObject((LuaState*)lua_getstateuserdata(L1), &tobject);
    setnilvalue(&tobject);
    lua_pop(parentState->GetCState(), 1);
    return retObj;
}
示例#3
0
LuaObject LuaState::CreateThread(LuaState* parentState)
{
    lua_State* L1 = lua_newthread(LuaState_to_lua_State(parentState));
    lua_TValue tobject;
#if LUA_REFCOUNT
    setnilvalue2n(L1, &tobject);
#else
    setnilvalue(&tobject);
#endif /* LUA_REFCOUNT */
    setthvalue(parentState->GetCState(), &tobject, L1);

	LuaObject retObj = LuaObject(lua_State_To_LuaState(L1), &tobject);
    setnilvalue(&tobject);
    lua_pop(LuaState_to_lua_State(parentState), 1);
    return retObj;
}
示例#4
0
void Script::detachFromActor() {
    invokeMethod<LuaObject>("detachFromActor");
    scriptObject = LuaObject();

    LogicalComponent::detachFromActor();
}
示例#5
0
LuaObject LuaState::GetRegistry()
{
	return LuaObject(this, LUA_REGISTRYINDEX);  //{  lua_getregistry(m_state);
}
示例#6
0
LuaObject LuaState::GetGlobals() throw()
{
	return LuaObject( this, gt(m_state) );
}
示例#7
0
LuaObject LuaState::GetGlobals() throw()
{
	return LuaObject( this, gt(LuaState_to_lua_State(this)) );
}
示例#8
0
LuaObject LuaState::GetRegistry()
{
	return LuaObject(this, LUA_REGISTRYINDEX);  //{  lua_getregistry(LuaState_to_lua_State(this));
}