mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
Lunatic: remove DBG_ variable for _DEBUG_LUNATIC=0.
git-svn-id: https://svn.eduke32.com/eduke32@3966 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
ac3a6a1bd2
commit
7860fb8c01
2 changed files with 37 additions and 25 deletions
|
@ -1704,6 +1704,11 @@ local function our_require(modname, ...)
|
|||
error("module name must be a nonempty string", 2)
|
||||
end
|
||||
|
||||
-- For _LUNATIC_DBG
|
||||
if (modname:match("^_LUNATIC") and ffiC._DEBUG_LUNATIC == 0) then
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Handle the section between module() and require("end_gamevars").
|
||||
if (modname == "end_gamevars") then
|
||||
local thismodname = getcurmodname("require")
|
||||
|
@ -2371,7 +2376,8 @@ gv = setmtonce(gv_, tmpmt)
|
|||
defs_c.create_globals(_G)
|
||||
|
||||
-- REMOVE this for release
|
||||
DBG_ = {}
|
||||
if (ffiC._DEBUG_LUNATIC ~= 0) then
|
||||
local DBG_ = {}
|
||||
DBG_.debug = require("debug")
|
||||
DBG_.printkv = printkv
|
||||
DBG_.loadstring = loadstring
|
||||
|
@ -2383,7 +2389,7 @@ DBG_.oom = function()
|
|||
end
|
||||
|
||||
-- Test reading from all struct members
|
||||
function DBG_.testmembread()
|
||||
DBG_.testmembread = function()
|
||||
for _1, sac in pairs { con_lang.StructAccessCode, con_lang.StructAccessCode2 } do
|
||||
for what, labels in pairs(sac) do
|
||||
if (what~="tspr") then
|
||||
|
@ -2407,6 +2413,8 @@ local tmp=]]..
|
|||
end
|
||||
end
|
||||
|
||||
allowed_modules._LUNATIC_DBG = DBG_
|
||||
end
|
||||
|
||||
---=== Finishing environment setup ===---
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ local bit = require("bit")
|
|||
local math = require("math")
|
||||
|
||||
local pcall = pcall
|
||||
local DBG_ = DBG_
|
||||
local DBG_ = require("_LUNATIC_DBG")
|
||||
|
||||
print('---=== ELua Test script ===---')
|
||||
|
||||
|
@ -15,6 +15,10 @@ local function printf(fmt, ...)
|
|||
end
|
||||
|
||||
local function checkfail(funcstr, expectedmsg)
|
||||
if (DBG_ == nil) then
|
||||
return
|
||||
end
|
||||
|
||||
local status, errmsg = pcall(DBG_.loadstring(funcstr))
|
||||
if (status) then
|
||||
print('^21ERROR:^O '..funcstr.." DIDN'T fail")
|
||||
|
@ -275,7 +279,7 @@ gameevent
|
|||
gv.EVENT_ENTERLEVEL,
|
||||
|
||||
function()
|
||||
if (gv._DEBUG_LUNATIC) then
|
||||
if (DBG_ ~= nil) then
|
||||
DBG_.testmembread()
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue