diff options
-rw-r--r-- | LuaSL/src/LSL.lua | 26 |
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 | ||
31 | local LSL = {}; | 31 | local LSL = {}; |
32 | 32 | ||
33 | |||
34 | -- Debugging aids | ||
35 | |||
36 | -- Functions to print tables. | ||
37 | local print_table, print_table_start; | ||
38 | |||
39 | function print_table_start(table, space, name) | ||
40 | print(space .. name .. ": "); | ||
41 | print(space .. "{"); | ||
42 | print_table(table, space .. " "); | ||
43 | print(space .. "}"); | ||
44 | end | ||
45 | |||
46 | function 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 | ||
56 | end | ||
57 | |||
58 | |||
33 | -- LSL constants. | 59 | -- LSL constants. |
34 | 60 | ||
35 | LSL.PI = 3.14159265358979323846264338327950; | 61 | LSL.PI = 3.14159265358979323846264338327950; |