IMPLEMENT_FUNCTION(VBasePlayer, ClientSetServerInfo) { P_GET_STR(Value); P_GET_STR(Key); P_GET_SELF; Self->DoClientSetServerInfo(Key, Value); }
void AUnLua::execcompileScript(FFrame& Stack, RESULT_DECL) { guard(AUnLua::execcompileScript); P_GET_STR(scriptCode); P_GET_INT_REF(successful); P_FINISH unguardexec; }
IMPLEMENT_FUNCTION(VBasePlayer, ClientHudMessage) { P_GET_FLOAT(Time2); P_GET_FLOAT(Time1); P_GET_FLOAT(HoldTime); P_GET_INT(HudHeight); P_GET_INT(HudWidth); P_GET_FLOAT(y); P_GET_FLOAT(x); P_GET_STR(ColourName); P_GET_INT(Colour); P_GET_INT(Id); P_GET_INT(Type); P_GET_NAME(Font); P_GET_STR(Message); P_GET_SELF; Self->DoClientHudMessage(Message, Font, Type, Id, Colour, ColourName, x, y, HudWidth, HudHeight, HoldTime, Time1, Time2); }
void AUnLua::execsetGlobalVariable(FFrame& Stack, RESULT_DECL) { guard(AUnLua::execsetGlobalVariable); P_GET_STR(varName); P_GET_STR(varValue); P_FINISH char* varName_u; char* varValue_u; varName_u = fstring2dupstr(&varName); varValue_u = fstring2dupstr(&varValue); lua_pushstring(luaState, varValue_u); lua_setglobal(luaState, varName_u); free(varValue_u); free(varName_u); unguardexec; }
void AUnLua::execrunLuaScript(FFrame& Stack, RESULT_DECL) { guard(AUnLua::execrunLuaScript); P_GET_STR(script); P_GET_STR_REF(resultAsString); P_GET_INT_REF(success); P_FINISH FString lualog; lua_pushlightuserdata(luaState, &lualog); lua_setglobal(luaState, "__logfstring"); const char *scrbuf_t = (const char*) script.GetCharArray().GetData(); int len = script.Len(); char *scrbuf = (char*) malloc(len); check(scrbuf != NULL); /* hack to convert tchar into char */ for(int i = 0; i < len; ++i) scrbuf[i] = scrbuf_t[i * 2]; int status = luaL_loadbuffer(luaState, scrbuf, len, "unrealscript"); free(scrbuf); if (status == LUA_OK) { status = lua_pcall(luaState, 0, 1, 0); if (status == LUA_OK) *success = 1; else if (status == LUA_ERRRUN) *success = 0; } else { *success = 0; } lualog += TEXT("\0"); lua_pushlightuserdata(luaState, NULL); lua_setglobal(luaState, "__logfstring"); unsigned int resultMsgLen = 0; const char* resultMsg = luaL_tolstring(luaState, -1, &resultMsgLen); lua_remove(luaState, -1); /* the result */ if (*success) *resultAsString = lualog; else *resultAsString = FString(resultMsg, resultMsgLen); *(DWORD*)Result = 0; unguardexec; }
void AUnLua::execgetGlobalVariable(FFrame& Stack, RESULT_DECL) { guard(AUnLua::execsetGlobalVariable); P_GET_STR(varName); P_GET_STR_REF(varValue); P_FINISH char* varName_u; const char* varValue_u; size_t len = 0; varName_u = fstring2dupstr(&varName); lua_getglobal(luaState, varName_u); varValue_u = luaL_tolstring(luaState, -1, &len); lua_pop(luaState, 1); free(varName_u); FString str(varValue_u, len); *varValue = str; unguardexec; }
IMPLEMENT_FUNCTION(VBasePlayer, ClientFinale) { P_GET_STR(Type); P_GET_SELF; Self->DoClientFinale(Type); }
IMPLEMENT_FUNCTION(VBasePlayer, ClientCentrePrint) { P_GET_STR(Str); P_GET_SELF; Self->DoClientCentrePrint(Str); }
IMPLEMENT_FUNCTION(VBasePlayer, ServerSetUserInfo) { P_GET_STR(Info); P_GET_SELF; Self->SetUserInfo(Info); }