summaryrefslogtreecommitdiffstats
path: root/lib/tolua++/src/bin/lua
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-06-17 19:03:56 +0200
committerHowaner <franzi.moos@googlemail.com>2014-06-17 19:03:56 +0200
commitc60ba8a52d6f84316eae041a24e395a4c37ae181 (patch)
treeedb983f4b20312115bc1033a2bd5a89c615ed30e /lib/tolua++/src/bin/lua
parentCheck block type from cBlockEntity (diff)
parentMerge pull request #1099 from Howaner/Blocks (diff)
downloadcuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.tar
cuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.tar.gz
cuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.tar.bz2
cuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.tar.lz
cuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.tar.xz
cuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.tar.zst
cuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.zip
Diffstat (limited to 'lib/tolua++/src/bin/lua')
-rw-r--r--lib/tolua++/src/bin/lua/_driver.lua93
-rw-r--r--lib/tolua++/src/bin/lua/basic.lua2
-rw-r--r--lib/tolua++/src/bin/lua/compat-5.1.lua9
-rw-r--r--lib/tolua++/src/bin/lua/declaration.lua2
-rw-r--r--lib/tolua++/src/bin/lua/feature.lua2
5 files changed, 100 insertions, 8 deletions
diff --git a/lib/tolua++/src/bin/lua/_driver.lua b/lib/tolua++/src/bin/lua/_driver.lua
new file mode 100644
index 000000000..21db96098
--- /dev/null
+++ b/lib/tolua++/src/bin/lua/_driver.lua
@@ -0,0 +1,93 @@
+
+-- Allow debugging by ZBS, if run under the IDE:
+local mobdebugfound, mobdebug = pcall(require, "mobdebug")
+if mobdebugfound then mobdebug.start() end
+
+-- The list of valid arguments that the ToLua scripts can process:
+local KnownArgs = {
+ ['v'] = true,
+ ['h'] = true,
+ ['p'] = true,
+ ['P'] = true,
+ ['o'] = true,
+ ['n'] = true,
+ ['H'] = true,
+ ['S'] = true,
+ ['1'] = true,
+ ['L'] = true,
+ ['D'] = true,
+ ['W'] = true,
+ ['C'] = true,
+ ['E'] = true,
+ ['t'] = true,
+ ['q'] = true,
+}
+
+
+
+
+
+-- The flags table used by ToLua scripts, to be filled from the cmdline params:
+flags = {}
+
+-- Te extra parameters used by ToLua scripts:
+_extra_parameters = {}
+
+-- ToLua version required by the scripts:
+TOLUA_VERSION = "tolua++-1.0.92"
+
+-- Lua version used by ToLua, required by the scripts:
+TOLUA_LUA_VERSION = "Lua 5.1"
+
+
+
+
+
+
+-- Process the cmdline params into the flags table:
+local args = arg or {}
+local argc = #args
+local i = 1
+while (i <= argc) do
+ local argv = args[i]
+ if (argv:sub(1, 1) == "-") then
+ if (KnownArgs[argv:sub(2)]) then
+ print("Setting flag \"" .. argv:sub(2) .. "\" to \"" .. args[i + 1] .. "\".")
+ flags[argv:sub(2)] = args[i + 1]
+ i = i + 1
+ else
+ print("Unknown option (" .. i .. "): " .. argv)
+ print("Aborting.")
+ os.exit(1)
+ end
+ else
+ print("Setting flag \"f\" to \"" .. argv .. "\".")
+ flags['f'] = argv
+ break
+ end
+ i = i + 1
+end
+
+-- Get the path where the scripts are located:
+path = args[0] or ""
+local index = path:find("/[^/]*$")
+if (index == nil) then
+ index = path:find("\\[^\\]*$")
+end
+if (index ~= nil) then
+ path = path:sub(1, index)
+end
+
+print("path is set to \"" .. path .. "\".")
+
+
+
+
+
+-- Call the ToLua processor:
+dofile(path .. "all.lua")
+
+
+
+
+
diff --git a/lib/tolua++/src/bin/lua/basic.lua b/lib/tolua++/src/bin/lua/basic.lua
index 4bff5276b..7b401d638 100644
--- a/lib/tolua++/src/bin/lua/basic.lua
+++ b/lib/tolua++/src/bin/lua/basic.lua
@@ -383,7 +383,7 @@ end
-- called to output an error message
function output_error_hook(...)
- return string.format(...)
+ return string.format(...) -- Note that this line must not end in the triple-dot-parenthesis due to pre-parsing
end
-- custom pushers
diff --git a/lib/tolua++/src/bin/lua/compat-5.1.lua b/lib/tolua++/src/bin/lua/compat-5.1.lua
index 7a2c60b69..c591592a6 100644
--- a/lib/tolua++/src/bin/lua/compat-5.1.lua
+++ b/lib/tolua++/src/bin/lua/compat-5.1.lua
@@ -18,17 +18,16 @@ local function pp_dofile(path)
local ret = file:read("*a")
file:close()
- ret = string.gsub(ret, "%.%.%.%s*%)", "...) local arg = {n=select('#', ...), ...};")
-
+ ret = string.gsub(ret, "%.%.%.%s*%)$", "...) local arg = {n=select('#', ...), ...};")
+
loaded = true
return ret
end
end
- local f = load(getfile, path)
+ local f, err = load(getfile, path)
if not f then
-
- error("error loading file "..path)
+ error("error loading file " .. path .. ": " .. err)
end
return f()
end
diff --git a/lib/tolua++/src/bin/lua/declaration.lua b/lib/tolua++/src/bin/lua/declaration.lua
index 26ceeba22..3ec6e144f 100644
--- a/lib/tolua++/src/bin/lua/declaration.lua
+++ b/lib/tolua++/src/bin/lua/declaration.lua
@@ -524,7 +524,7 @@ function Declaration (s,kind,is_parameter)
end
-- check the form: mod type* name
- local s1 = gsub(s,"(%b\[\])",function (n) return gsub(n,'%*','\1') end)
+ local s1 = gsub(s,"(%b%[%])",function (n) return gsub(n,'%*','\1') end)
t = split_c_tokens(s1,'%*')
if t.n == 2 then
t[2] = gsub(t[2],'\1','%*') -- restore * in dimension expression
diff --git a/lib/tolua++/src/bin/lua/feature.lua b/lib/tolua++/src/bin/lua/feature.lua
index 042b5d28e..14f01d325 100644
--- a/lib/tolua++/src/bin/lua/feature.lua
+++ b/lib/tolua++/src/bin/lua/feature.lua
@@ -132,7 +132,7 @@ function classFeature:cfuncname (n)
if not fname or fname == '' then
fname = self.name
end
- n = string.gsub(n..'_'.. (fname), "[<>:, \.%*&]", "_")
+ n = string.gsub(n..'_'.. (fname), "[<>:, %.%*&]", "_")
return n
end