Remove luajit ffi particle access

No point to having it sit around effectively commented out.
This commit is contained in:
Tamás Bálint Misius 2023-10-25 15:17:29 +02:00
parent d5681d8ed9
commit b5d40a49f8
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -424,22 +424,6 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
lua_setfield(l, tptProperties, "version");
lua_sethook(l, &luacon_hook, LUA_MASKCOUNT, 200);
#ifdef FFI
//LuaJIT's ffi gives us direct access to parts data, no need for nested metatables. HOWEVER, this is in no way safe, it's entirely possible for someone to try to read parts[-10]
lua_pushlightuserdata(l, parts);
lua_setfield(l, tptProperties, "partsdata");
tpt_lua_dostring (l, "ffi = require(\"ffi\")\n\
ffi.cdef[[\n\
typedef struct { int type; int life, ctype; float x, y, vx, vy; float temp; int tmp3; int tmp4; int flags; int tmp; int tmp2; unsigned int dcolour; } particle;\n\
]]\n\
tpt.parts = ffi.cast(\"particle *\", tpt.partsdata)\n\
ffi = nil\n\
tpt.partsdata = nil");
//Since ffi is REALLY REALLY dangrous, we'll remove it from the environment completely (TODO)
//lua_pushliteral(l, "parts");
//tptPartsCData = lua_gettable(l, tptProperties);
#else
lua_newtable(l);
tptParts = lua_gettop(l);
lua_newtable(l);
@ -466,7 +450,6 @@ tpt.partsdata = nil");
tptPart = new LuaSmartRef();
tptPart->Assign(l, -1);
lua_pop(l, 1);
#endif
lua_newtable(l);
tptElements = lua_gettop(l);