mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 15:21:48 +00:00
775d652d7d
git-svn-id: https://svn.eduke32.com/eduke32@2148 1a8010ca-5511-0410-912e-c29ae57300e0
52 lines
1.5 KiB
Text
52 lines
1.5 KiB
Text
-- test script for ELua/Lunatic Interpreter
|
|
|
|
print('--- ELua Test script ---')
|
|
|
|
local function checkfail(funcstr)
|
|
local status, res = pcall(DBG_.loadstring(funcstr))
|
|
if (status) then
|
|
print('ERROR: '..funcstr.." DIDN'T fail")
|
|
else
|
|
print('SUCCESS: '..funcstr.." failed: "..res)
|
|
end
|
|
end
|
|
|
|
local i
|
|
|
|
print('tweaking sector pals')
|
|
---[[
|
|
for i = 0, gv.numsectors/2 do
|
|
sector[i].floorpal = 1;
|
|
sector[i].ceilingpal = 2;
|
|
end
|
|
|
|
checkfail('gv.sprite[0].yrepeat = 100') -- direct gv array access forbidden
|
|
print('tweaking some sprites 2')
|
|
i = 562
|
|
spriteext[i].alpha = 0.5;
|
|
sprite[i].cstat = bit.bor(sprite[i].cstat, 2+512);
|
|
spriteext[i].pitch = 128;
|
|
spriteext[i].roll = 256;
|
|
for spr in spritesofsect(307) do -- some fence sprites in E1L1
|
|
print('spr', spr)
|
|
sprite[spr].pal = 6
|
|
end
|
|
for spr in spritesofsect(236) do
|
|
print('#spr', spr)
|
|
end
|
|
--]]
|
|
print('_G contains:')
|
|
for k,v in pairs(_G) do
|
|
print(k, v)
|
|
end
|
|
|
|
checkfail('print(sprite[100000].ceilingpal)') -- oob read access
|
|
checkfail('setmetatable(sprite, {})') -- set metatable forbidden
|
|
checkfail('sector[-1].ceilingpal = 4') -- oob write access
|
|
checkfail('sector[0].wallnum = 0') -- wallnum member is read-only
|
|
checkfail('gv.numsectors = 4') -- gv.numsectors is read-only
|
|
checkfail('sector[4] = sector[6]') -- direct sector write access forbidden
|
|
checkfail("require('os')") -- 'require' has been thrown away to be replaced by
|
|
-- something more restricted later
|
|
|
|
print('--- end test script ---')
|