mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Fix r2ed
--HG-- branch : develop
This commit is contained in:
parent
9283a74a22
commit
74e9aac960
2 changed files with 35 additions and 11 deletions
|
@ -1931,7 +1931,6 @@ void CLuaIHMRyzom::rawDebugInfo(const std::string &dbg)
|
||||||
#endif
|
#endif
|
||||||
pIM->displaySystemInfo( LuaHelperStuff::formatLuaErrorSysInfo(dbg));
|
pIM->displaySystemInfo( LuaHelperStuff::formatLuaErrorSysInfo(dbg));
|
||||||
}
|
}
|
||||||
nldebug("LUA: '%s'", dbg.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,26 @@ function forEach(table, fn)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------
|
||||||
|
-- whatever
|
||||||
|
table.setn = function(table, n)
|
||||||
|
assert(table)
|
||||||
|
local mt = getmetatable(table)
|
||||||
|
if mt ~= nil then
|
||||||
|
if mt.__next ~= nil then
|
||||||
|
table.Size = n
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
|
||||||
-- extension to table library : remove all content of a table without deleting the table object
|
-- extension to table library : remove all content of a table without deleting the table object
|
||||||
function table.clear(tbl)
|
function table.clear(tbl)
|
||||||
while next(tbl) do
|
while next(tbl) do
|
||||||
table.remove(tbl, next(tbl))
|
tbl[next(tbl)] = nil
|
||||||
end
|
end
|
||||||
|
table.setn(tbl, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -177,12 +191,12 @@ end
|
||||||
-------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------
|
||||||
-- enclose a string by double quotes
|
-- enclose a string by double quotes
|
||||||
function strifyXml(str)
|
function strifyXml(str)
|
||||||
strxml = string.gsub(str, ">", ">")
|
local strxml = string.gsub(tostring(str), ">", ">")
|
||||||
strxml = string.gsub(strxml, "<", "<")
|
strxml = string.gsub(strxml, "<", "<")
|
||||||
strxml = string.gsub(strxml, "&", "&")
|
strxml = string.gsub(strxml, "&", "&")
|
||||||
strxml = string.gsub(strxml, "'", "'")
|
strxml = string.gsub(strxml, "'", "'")
|
||||||
strxml = string.gsub(strxml, '"', """)
|
strxml = string.gsub(strxml, '"', """)
|
||||||
return [["]] .. tostring(strxml) .. [["]]
|
return [["]] .. strxml .. [["]]
|
||||||
end
|
end
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -261,11 +275,23 @@ end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
assert(table.getn ~= nil) -- default lib should have been opened
|
-- assert(table.getn ~= nil) -- default lib should have been opened
|
||||||
|
|
||||||
|
--if oldTableGetnFunction == nil then
|
||||||
|
-- oldTableGetnFunction = table.getn
|
||||||
|
--end
|
||||||
|
--
|
||||||
|
--table.getn = function(table)
|
||||||
|
-- assert(table)
|
||||||
|
-- local mt = getmetatable(table)
|
||||||
|
-- if mt ~= nil then
|
||||||
|
-- if mt.__next ~= nil then
|
||||||
|
-- return table.Size
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- return oldTableGetnFunction(table)
|
||||||
|
--end
|
||||||
|
|
||||||
if oldTableGetnFunction == nil then
|
|
||||||
oldTableGetnFunction = table.getn
|
|
||||||
end
|
|
||||||
|
|
||||||
table.getn = function(table)
|
table.getn = function(table)
|
||||||
assert(table)
|
assert(table)
|
||||||
|
@ -275,12 +301,11 @@ table.getn = function(table)
|
||||||
return table.Size
|
return table.Size
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return oldTableGetnFunction(table)
|
return #table
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- redefine the hardcoded 'pairs' function to use the redefined 'next'
|
-- redefine the hardcoded 'pairs' function to use the redefined 'next'
|
||||||
-- hardcoded version uses the C version of next, not the lua one if it has been redefined
|
-- hardcoded version uses the C version of next, not the lua one if it has been redefined
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue