mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 09:21:36 +00:00
Lunatic: fix one stack index, comment on a problem with ffi.C access.
git-svn-id: https://svn.eduke32.com/eduke32@2710 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
35d989646e
commit
fc23045675
3 changed files with 13 additions and 6 deletions
|
@ -452,7 +452,7 @@ local function printkv(label, table)
|
|||
print('----------')
|
||||
end
|
||||
|
||||
printkv('_G AFTER SETFENV', _G)
|
||||
--printkv('_G AFTER SETFENV', _G)
|
||||
|
||||
|
||||
---=== Restricted access to C variables from Lunatic ===---
|
||||
|
@ -469,6 +469,7 @@ local tmpmt = {
|
|||
}
|
||||
oG.setmetatable(det, tmpmt)
|
||||
|
||||
-- XXX: this is incorrect -- ffi.C also contains C library functions, etc.
|
||||
-- GLOBAL gv: provides access to C global *scalars*
|
||||
gv = {
|
||||
-- all non-scalars need to be explicitly listed
|
||||
|
@ -486,8 +487,8 @@ gv = {
|
|||
actor = det,
|
||||
ud = det,
|
||||
|
||||
luaJIT_BC_con_lang,
|
||||
luaJIT_BC_lunacon,
|
||||
luaJIT_BC_con_lang = det,
|
||||
luaJIT_BC_lunacon = det,
|
||||
}
|
||||
local tmpmt = {
|
||||
__index = ffiC,
|
||||
|
@ -740,7 +741,7 @@ DBG_.loadGamevarsString = loadGamevarsString
|
|||
|
||||
---=== Finishing environment setup ===---
|
||||
|
||||
printkv('_G AFTER DECLS', _G)
|
||||
--printkv('_G AFTER DECLS', _G)
|
||||
|
||||
|
||||
-- PiL 14.2 continued
|
||||
|
|
|
@ -111,7 +111,7 @@ int32_t El_RunOnce(El_State *estate, const char *fn)
|
|||
|
||||
if (i == LUA_ERRSYNTAX)
|
||||
{
|
||||
OSD_Printf("state \"%s\" syntax error: %s\n", estate->name, lua_tostring(estate->L, 1)); // get err msg
|
||||
OSD_Printf("state \"%s\" syntax error: %s\n", estate->name, lua_tostring(estate->L, -1)); // get err msg
|
||||
lua_pop(estate->L, 1);
|
||||
return 3;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ if (vol==1 and lev==8) then
|
|||
end
|
||||
|
||||
--]]
|
||||
DBG_.printkv('_G in test.elua', _G)
|
||||
--DBG_.printkv('_G in test.elua', _G)
|
||||
|
||||
checkfail('print(sprite[100000].ceilingpal)') -- oob read access
|
||||
checkfail('setmetatable(sprite, {})') -- set metatable forbidden
|
||||
|
@ -102,6 +102,12 @@ checkfail("new_global = 345") -- we should declare globals
|
|||
checkfail('gv.CEILING = 3') -- can't redefine constants in 'gv'
|
||||
checkfail('string.dump(setevent)') -- string.dump is unavailable
|
||||
|
||||
-- This is problematic, even though pretty much every access will yield a
|
||||
-- "missing declaration" error.
|
||||
-- See http://luajit.org/ext_ffi_api.html#ffi_C about what stuff ffi.C contains.
|
||||
checkfail('gv.luaJIT_setmode(nil, 0, 0)')
|
||||
|
||||
setevent(gv.EVENT_JUMP, function() print("jump!") end)
|
||||
|
||||
|
||||
print('---=== END TEST SCRIPT ===---')
|
||||
|
|
Loading…
Reference in a new issue