1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-10-20 13:29:30 +00:00

More work on the mod v1.1 compatibility layer

This commit is contained in:
fgenesis 2021-01-12 23:51:18 +01:00
commit 1e9c415624
11 changed files with 953 additions and 33 deletions

29
tools/oldfunclist.lua Normal file
View file

@ -0,0 +1,29 @@
-- To generate the list of function names available in 1.1, run this script on ScriptInterface.cpp
-- obtained from:
-- https://hg.icculus.org/icculus/aquaria/raw-file/75924df9cbe8/Aquaria/ScriptInterface.cpp
local F = {}
for line in io.lines((...)) do
local f = line:match'^%s*lua_register%s*%(.-%"([^%"]+)%".-%)'
if f then
F[f] = true
end
f = line:match'^%s*luar%s*%(%s*([%w_]+)%s*%)'
if f then
F[f] = true
end
end
-- These are commented out but the regex picks them up
F.opt = nil
F.options = nil
local LIST = {}
for k in pairs(F) do
table.insert(LIST, k)
end
table.sort(LIST)
print(table.concat(LIST, "\n"))

45
tools/scriptfunclist.lua Normal file
View file

@ -0,0 +1,45 @@
-- Generate list of script function names available in the OSE version
-- call with path/to/ScriptInterface.cpp
local RO = { flipHorizontal = true, flipVertical = true }
local Q = {}
local F = {}
local function emit(prefix, a)
for k in pairs(a) do
F[prefix .. "_" .. k] = true
end
end
for line in io.lines((...)) do
local fn = line:match"^%s*luaRegister%(([%w_]+)%)"
if fn then
F[fn] = true
end
local rf = line:match"^%s*RO_FUNC%(.-([%w_]+)%s*%)"
if rf then
RO[rf] = true
end
local qf = line:match"^%s*Q_FUNC%(.-([%w_]+)%s*%)"
if qf then
Q[qf] = true
RO[qf] = true
end
local lut = { QUAD = Q, ROBJ = RO }
local c, p = line:match"^%s*MAKE_([A-Z]+)_FUNCS%(.-([%w_]+)%s*%)"
if c and p ~= "prefix" then
--print(c, p, line)
emit(p, lut[c])
end
end
local LIST = {}
for k in pairs(F) do
table.insert(LIST, k)
end
table.sort(LIST)
print(table.concat(LIST, "\n"))