How big, exactly? Where is the code you are using to get luaL_loadfile and luaL_loadstring?
I got luaL_loadfile and luaL_loadstring working all fine but when i try to load a "larger" string or file it crash the game..
I can load the "larger" file or string using the normal lua_run_cl and lua_openscript_cl just fine...
Anyone know why that is the case and maybe a way to fix it?
Any feedback would be greatly appreciated
How big, exactly? Where is the code you are using to get luaL_loadfile and luaL_loadstring?
Allready at around 100 lines of simple "print('test')"
I just don't understand why running the lua normaly would work but not this way?Code:lua_gettop = (int(*)(lua_State*))(DWORD)GetProcAddress(GetModuleHandle("lua_shared.dll"), "lua_gettop"); luaL_loadstring = (int(*)(lua_State*, const char*))(DWORD)GetProcAddress(GetModuleHandle("lua_shared.dll"), "luaL_loadstring"); lua_pcall = (int(*)(lua_State*, int, int, int))(DWORD)GetProcAddress(GetModuleHandle("lua_shared.dll"), "lua_pcall"); if(!lua_gettop(luaState)) { luaL_loadstring(luaState, string); lua_pcall(luaState, 0, 0, 0); }
It should be the same thing? Right?
It's also pretty odd that it works fine if the string or file is small.. Like if it only has 1 line or 10..
It also dosen't matter if i put it on multiple lines or one line... I think it just don't like doing that many "actions"
Last edited by kasperbjerby; 07-25-2014 at 02:55 PM.
I'll test your code and see if I crash later on today.
use runstring you dumbfuck
z346etn56jzd7egth (07-27-2014)
If you guys could get on my level you could figure it out.
paster detected
you're not even @BigBadWilly 's level so you can stop bragging about your nonexisting skills :willythumb:
nah I got lazy. Go look at dis.
https://******.com/tdsx/gmcl_externa...uxiliary.h#L46
It's a shitty way to do it, though. You should do if (!luaL_loadbuffer call) then LUA->Call. I fucked that part up.
Last edited by tdsx; 08-05-2014 at 01:44 PM.
is what i useCode:void RunString(const char* string) { int code = luaL_loadbuffer(m_luaState, string, strlen(string), "=RunString"); if(code) { const char* szError = lua_tostring(m_luaState, -2); pCvar->ConsoleColorPrintf(Color(192, 57, 43, 255), "[COMPILE ERROR] %s\n", szError); lua_pop(m_luaState, 2); return; } code = lua_pcall(m_luaState, 0, 0, m_iError); if(code != LUA_SUCCESS) { lua_pop(m_luaState, 1); } }
skids are helping skids wtf is that shit