summaryrefslogtreecommitdiffstats
path: root/lib/tolua++/src/bin/lua/function.lua
diff options
context:
space:
mode:
authordaniel0916 <theschokolps@gmail.com>2014-04-07 20:12:17 +0200
committerdaniel0916 <theschokolps@gmail.com>2014-04-07 20:12:17 +0200
commit2e9754ac1cf0537c12ab7974cf55c451c0724540 (patch)
tree713c5b8c8f22f77893b30b9c8cefca4a7c491483 /lib/tolua++/src/bin/lua/function.lua
parentFixed merge conflict (diff)
parentFixed some more minor issues with the redstone simulator. (diff)
downloadcuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.tar
cuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.tar.gz
cuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.tar.bz2
cuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.tar.lz
cuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.tar.xz
cuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.tar.zst
cuberite-2e9754ac1cf0537c12ab7974cf55c451c0724540.zip
Diffstat (limited to 'lib/tolua++/src/bin/lua/function.lua')
-rw-r--r--lib/tolua++/src/bin/lua/function.lua15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/tolua++/src/bin/lua/function.lua b/lib/tolua++/src/bin/lua/function.lua
index 2358e9ff7..9338e0fbc 100644
--- a/lib/tolua++/src/bin/lua/function.lua
+++ b/lib/tolua++/src/bin/lua/function.lua
@@ -50,11 +50,20 @@ end
-- Write binding function
-- Outputs C/C++ binding function.
function classFunction:supcode (local_constructor)
-
local overload = strsub(self.cname,-2,-1) - 1 -- indicate overloaded func
local nret = 0 -- number of returned values
local class = self:inclass()
local _,_,static = strfind(self.mod,'^%s*(static)')
+ -- prototypes for enum functions
+ if self.args[1].type ~= 'void' then
+ local i=1
+ while self.args[i] do
+ if isenumtype(self.args[i].type) then
+ emitenumprototype(self.args[i].type)
+ end
+ i = i+1
+ end
+ end
if class then
if self.name == 'new' and self.parent.flags.pure_virtual then
@@ -449,9 +458,8 @@ end
-- Internal constructor
function _Function (t)
setmetatable(t,classFunction)
-
if t.const ~= 'const' and t.const ~= '' then
- error("#invalid 'const' specification")
+ error("#invalid 'const' specification: " .. t.const)
end
append(t)
@@ -480,7 +488,6 @@ end
function Function (d,a,c)
--local t = split(strsub(a,2,-2),',') -- eliminate braces
--local t = split_params(strsub(a,2,-2))
-
if not flags['W'] and string.find(a, "%.%.%.%s*%)") then
warning("Functions with variable arguments (`...') are not supported. Ignoring "..d..a..c)