|
|
@ -167,6 +167,15 @@ function printall(table)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function printall_ipairs(table)
|
|
|
|
|
|
|
|
local ok,f,t,k = pcall(ipairs,table)
|
|
|
|
|
|
|
|
if ok then
|
|
|
|
|
|
|
|
for k,v in f,t,k do
|
|
|
|
|
|
|
|
print(string.format("%-23s\t = %s",tostring(k),tostring(v)))
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function copyall(table)
|
|
|
|
function copyall(table)
|
|
|
|
local rv = {}
|
|
|
|
local rv = {}
|
|
|
|
for k,v in pairs(table) do rv[k] = v end
|
|
|
|
for k,v in pairs(table) do rv[k] = v end
|
|
|
@ -286,6 +295,7 @@ function dfhack.interpreter(prompt,hfile,env)
|
|
|
|
" '= foo' => '_1,_2,... = foo'\n"..
|
|
|
|
" '= foo' => '_1,_2,... = foo'\n"..
|
|
|
|
" '! foo' => 'print(foo)'\n"..
|
|
|
|
" '! foo' => 'print(foo)'\n"..
|
|
|
|
" '~ foo' => 'printall(foo)'\n"..
|
|
|
|
" '~ foo' => 'printall(foo)'\n"..
|
|
|
|
|
|
|
|
" '@ foo' => 'printall_ipairs(foo)'\n"..
|
|
|
|
"All of these save the first result as '_'.")
|
|
|
|
"All of these save the first result as '_'.")
|
|
|
|
print_banner = false
|
|
|
|
print_banner = false
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -305,6 +315,10 @@ function dfhack.interpreter(prompt,hfile,env)
|
|
|
|
print(table.unpack(data,2,data.n))
|
|
|
|
print(table.unpack(data,2,data.n))
|
|
|
|
printall(data[2])
|
|
|
|
printall(data[2])
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
|
|
|
|
['@'] = function(data)
|
|
|
|
|
|
|
|
print(table.unpack(data,2,data.n))
|
|
|
|
|
|
|
|
printall_ipairs(data[2])
|
|
|
|
|
|
|
|
end,
|
|
|
|
['='] = function(data)
|
|
|
|
['='] = function(data)
|
|
|
|
for i=2,data.n do
|
|
|
|
for i=2,data.n do
|
|
|
|
local varname = '_'..vcnt
|
|
|
|
local varname = '_'..vcnt
|
|
|
|