|
|
@ -151,8 +151,6 @@ static size_t __stdcall PushValue(size_t ret,uint32_t eax,uint32_t ebx,uint32_t
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
{
|
|
|
|
lua::state st=lua::glua::Get();
|
|
|
|
lua::state st=lua::glua::Get();
|
|
|
|
st.getglobal("err");
|
|
|
|
|
|
|
|
int perr=st.gettop();
|
|
|
|
|
|
|
|
st.getglobal("OnFunction");
|
|
|
|
st.getglobal("OnFunction");
|
|
|
|
if(st.is<lua::nil>())
|
|
|
|
if(st.is<lua::nil>())
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
@ -175,7 +173,7 @@ static size_t __stdcall PushValue(size_t ret,uint32_t eax,uint32_t ebx,uint32_t
|
|
|
|
st.setfield("ebp");
|
|
|
|
st.setfield("ebp");
|
|
|
|
st.push(ret);
|
|
|
|
st.push(ret);
|
|
|
|
st.setfield("ret");
|
|
|
|
st.setfield("ret");
|
|
|
|
st.pcall(1,1,perr);
|
|
|
|
DFHack::Lua::SafeCall(DFHack::Core::getInstance().getConsole(),st,1,1);
|
|
|
|
return st.as<uint32_t>();
|
|
|
|
return st.as<uint32_t>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static int Get_PushValue(lua_State *L)
|
|
|
|
static int Get_PushValue(lua_State *L)
|
|
|
@ -210,6 +208,17 @@ static int Resume_Df(lua_State *L)
|
|
|
|
DFHack::Core::getInstance().Resume();
|
|
|
|
DFHack::Core::getInstance().Resume();
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int Cast(lua_State *L)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
lua::state st(L);
|
|
|
|
|
|
|
|
if(DFHack::Lua::IsDFObject(st,1)!=DFHack::Lua::OBJ_TYPE)
|
|
|
|
|
|
|
|
st.error("First argument must be df type!");
|
|
|
|
|
|
|
|
if(!st.is<lua::number>(2)) //todo maybe lightuserdata?
|
|
|
|
|
|
|
|
st.error("Second argument must be pointer as a number!");
|
|
|
|
|
|
|
|
st.getfield("_identity",1);
|
|
|
|
|
|
|
|
DFHack::Lua::PushDFObject(st,(DFHack::type_identity*)lua_touserdata(st,-1),(void*)st.as<int>(2));
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
const luaL_Reg lua_misc_func[]=
|
|
|
|
const luaL_Reg lua_misc_func[]=
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{"alloc",lua_malloc},
|
|
|
|
{"alloc",lua_malloc},
|
|
|
@ -224,6 +233,7 @@ const luaL_Reg lua_misc_func[]=
|
|
|
|
{"calldf",Call_Df},
|
|
|
|
{"calldf",Call_Df},
|
|
|
|
{"suspend",Suspend_Df},
|
|
|
|
{"suspend",Suspend_Df},
|
|
|
|
{"resume",Resume_Df},
|
|
|
|
{"resume",Resume_Df},
|
|
|
|
|
|
|
|
{"cast",Cast},
|
|
|
|
{NULL,NULL}
|
|
|
|
{NULL,NULL}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
void lua::RegisterMisc(lua::state &st)
|
|
|
|
void lua::RegisterMisc(lua::state &st)
|
|
|
|