Lunatic: make some variables local, fix some bugs found using listglobals.sh.

git-svn-id: https://svn.eduke32.com/eduke32@3596 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-03-24 18:53:14 +00:00
parent ea118fe436
commit 290eb3a962
3 changed files with 6 additions and 4 deletions

View file

@ -25,7 +25,7 @@ module(...)
-- Generate C decl for a sequence of <nelts> const struct members. -- Generate C decl for a sequence of <nelts> const struct members.
-- For example, for 4 elements, -- For example, for 4 elements,
-- "const $ _r1, _f2, _u3, _n4;" -- "const $ _r1, _f2, _u3, _n4;"
function flatten_array(nelts, rng) local function flatten_array(nelts, rng)
local strtab = { "$ " } local strtab = { "$ " }
if (rng and rng.getu32==nil) then if (rng and rng.getu32==nil) then

View file

@ -1,6 +1,8 @@
-- Bound-checking functions for engine and game "things". -- Bound-checking functions for engine and game "things".
local ffiC = require("ffi").C local ffiC = require("ffi").C
local error = error
local con_lang = require("con_lang") local con_lang = require("con_lang")
local bcheck = {} local bcheck = {}

View file

@ -315,7 +315,7 @@ function _inittimer(ticspersec)
end end
function _gettimedate() function _gettimedate()
v = ffi.new("int32_t [8]") local v = ffi.new("int32_t [8]")
ffiC.G_GetTimeDate(v) ffiC.G_GetTimeDate(v)
return v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7] return v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]
end end
@ -1823,7 +1823,7 @@ local gamearray_methods = {
gar:resize(nelts) gar:resize(nelts)
for i=0,nelts-1 do for i=0,nelts-1 do
rawset(gar, i, (int==0) and nil or ints[i]) rawset(gar, i, (ints[i]==0) and nil or ints[i])
end end
f:close() f:close()
@ -1840,7 +1840,7 @@ local gamearray_methods = {
error("refusing to overwrite a file not created by a previous `writearraytofile'", 2) error("refusing to overwrite a file not created by a previous `writearraytofile'", 2)
end end
f = io.open(fn, "w+") local f, errmsg = io.open(fn, "w+")
if (f == nil) then if (f == nil) then
error([[failed opening "%s" for writing: %s]], fn, errmsg, 3) error([[failed opening "%s" for writing: %s]], fn, errmsg, 3)
end end