cLuaState: Added GetStackValues() auto-generated templates.
These will read consecutive values off the stack, each value of a type independent of the other values. Auto-generated because we don't have variadic templates in C++03.
This commit is contained in:
parent
89333c5870
commit
3df7d8446c
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user