summaryrefslogtreecommitdiffstats
path: root/src/Bindings/gen_LuaState_Call.lua
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-08-08 23:11:42 +0200
committermadmaxoft <github@xoft.cz>2014-08-08 23:11:42 +0200
commit3df7d8446c4d5387475a8d6c2f1c3d5ab28b28eb (patch)
tree12e480fd8ac3cf7b9a02a1fec3d9c3b15701280c /src/Bindings/gen_LuaState_Call.lua
parentRankMgr: Finished API implementation. (diff)
downloadcuberite-3df7d8446c4d5387475a8d6c2f1c3d5ab28b28eb.tar
cuberite-3df7d8446c4d5387475a8d6c2f1c3d5ab28b28eb.tar.gz
cuberite-3df7d8446c4d5387475a8d6c2f1c3d5ab28b28eb.tar.bz2
cuberite-3df7d8446c4d5387475a8d6c2f1c3d5ab28b28eb.tar.lz
cuberite-3df7d8446c4d5387475a8d6c2f1c3d5ab28b28eb.tar.xz
cuberite-3df7d8446c4d5387475a8d6c2f1c3d5ab28b28eb.tar.zst
cuberite-3df7d8446c4d5387475a8d6c2f1c3d5ab28b28eb.zip
Diffstat (limited to '')
-rw-r--r--src/Bindings/gen_LuaState_Call.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Bindings/gen_LuaState_Call.lua b/src/Bindings/gen_LuaState_Call.lua
index 17bae82b3..a5d09d4f1 100644
--- a/src/Bindings/gen_LuaState_Call.lua
+++ b/src/Bindings/gen_LuaState_Call.lua
@@ -182,6 +182,33 @@ for _, combination in ipairs(Combinations) do
WriteOverload(f, combination[1], combination[2])
end
+-- Generate the cLuaState::GetStackValues() multi-param templates:
+for i = 2, 6 do
+ f:write("/** Reads ", i, " consecutive values off the stack */\ntemplate <\n")
+
+ -- Write the template function header:
+ local txt = {}
+ for idx = 1, i do
+ table.insert(txt, "\ttypename ArgT" .. idx)
+ end
+ f:write(table.concat(txt, ",\n"))
+
+ -- Write the argument declarations:
+ txt = {}
+ f:write("\n>\nvoid GetStackValues(\n\tint a_BeginPos,\n")
+ for idx = 1, i do
+ table.insert(txt, "\tArgT" .. idx .. " & Arg" .. idx)
+ end
+ f:write(table.concat(txt, ",\n"))
+
+ -- Write the function body:
+ f:write("\n)\n{\n")
+ for idx = 1, i do
+ f:write("\tGetStackValue(a_BeginPos + ", idx - 1, ", Arg", idx, ");\n")
+ end
+ f:write("}\n\n\n\n\n\n")
+end
+
-- Close the generated file
f:close()