aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-05 20:57:23 +1000
committerDavid Walter Seikel2012-02-05 20:57:23 +1000
commit7b4e28a573caacec9f517b50b5a67d946403befd (patch)
tree514e347a76fc104793a46a93818f29a735ad4c70 /LuaSL
parentComplete the separation of the guts of luaproc message sending from the Lua w... (diff)
downloadSledjHamr-7b4e28a573caacec9f517b50b5a67d946403befd.zip
SledjHamr-7b4e28a573caacec9f517b50b5a67d946403befd.tar.gz
SledjHamr-7b4e28a573caacec9f517b50b5a67d946403befd.tar.bz2
SledjHamr-7b4e28a573caacec9f517b50b5a67d946403befd.tar.xz
Add table printing functions for debugging.
Diffstat (limited to 'LuaSL')
-rw-r--r--LuaSL/src/LSL.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/LuaSL/src/LSL.lua b/LuaSL/src/LSL.lua
index 8774121..82f7205 100644
--- a/LuaSL/src/LSL.lua
+++ b/LuaSL/src/LSL.lua
@@ -30,6 +30,32 @@ upvalue--either way is a bit more efficient and less error prone.
30 30
31local LSL = {}; 31local LSL = {};
32 32
33
34-- Debugging aids
35
36-- Functions to print tables.
37local print_table, print_table_start;
38
39function print_table_start(table, space, name)
40 print(space .. name .. ": ");
41 print(space .. "{");
42 print_table(table, space .. " ");
43 print(space .. "}");
44end
45
46function print_table(table, space)
47 for k, v in pairs(table) do
48 if type(v) == "table" then
49 print_table_start(v, space, k);
50 elseif type(v) == "string" then
51 print(space .. k .. ': "' .. v .. '";')
52 else
53 print(space .. k .. ": " .. v .. ";")
54 end
55 end
56end
57
58
33-- LSL constants. 59-- LSL constants.
34 60
35LSL.PI = 3.14159265358979323846264338327950; 61LSL.PI = 3.14159265358979323846264338327950;