summaryrefslogtreecommitdiffstats
path: root/lib/tolua++/src/bin/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tolua++/src/bin/lua')
-rw-r--r--lib/tolua++/src/bin/lua/basic.lua4
-rw-r--r--lib/tolua++/src/bin/lua/declaration.lua4
-rw-r--r--lib/tolua++/src/bin/lua/enumerate.lua6
-rw-r--r--lib/tolua++/src/bin/lua/function.lua2
4 files changed, 9 insertions, 7 deletions
diff --git a/lib/tolua++/src/bin/lua/basic.lua b/lib/tolua++/src/bin/lua/basic.lua
index b5788f2be..425cb6861 100644
--- a/lib/tolua++/src/bin/lua/basic.lua
+++ b/lib/tolua++/src/bin/lua/basic.lua
@@ -66,6 +66,8 @@ _global_enums = {}
-- List of auto renaming
_renaming = {}
+
+_enums = {}
function appendrenaming (s)
local b,e,old,new = strfind(s,"%s*(.-)%s*@%s*(.-)%s*$")
if not b then
@@ -146,7 +148,7 @@ function typevar(type)
end
-- is enum
-function isenum (type)
+function isenumtype (type)
return _enums[type]
end
diff --git a/lib/tolua++/src/bin/lua/declaration.lua b/lib/tolua++/src/bin/lua/declaration.lua
index 5a2adfed9..26ceeba22 100644
--- a/lib/tolua++/src/bin/lua/declaration.lua
+++ b/lib/tolua++/src/bin/lua/declaration.lua
@@ -227,10 +227,10 @@ function classDeclaration:outchecktype (narg)
--else
return '!tolua_istable(tolua_S,'..narg..',0,&tolua_err)'
--end
+ elseif isenumtype(self.type) ~= nil then
+ return '!tolua_is'..self.type..'(tolua_S,'..narg..','..def..',&tolua_err)'
elseif t then
return '!tolua_is'..t..'(tolua_S,'..narg..','..def..',&tolua_err)'
- elseif isenum(self.type) then
- return '!tolua_is'..self.type..'(tolua_S,'..narg..','..def..',&tolua_err)'
else
local is_func = get_is_function(self.type)
if self.ptr == '&' or self.ptr == '' then
diff --git a/lib/tolua++/src/bin/lua/enumerate.lua b/lib/tolua++/src/bin/lua/enumerate.lua
index ef3a9574c..09b22a094 100644
--- a/lib/tolua++/src/bin/lua/enumerate.lua
+++ b/lib/tolua++/src/bin/lua/enumerate.lua
@@ -49,7 +49,7 @@ function classEnumerate:print (ident,close)
end
function emitenumprototype(type)
- output("int tolua_is" .. string.gsub(type,"::","_") .. " (lua_State* L, int lo, const char * type, int def, tolua_Error* err);")
+ output("int tolua_is" .. string.gsub(type,"::","_") .. " (lua_State* L, int lo, int def, tolua_Error* err);")
end
_global_output_enums = {}
@@ -58,7 +58,7 @@ _global_output_enums = {}
function classEnumerate:supcode ()
if _global_output_enums[self.name] == nil then
_global_output_enums[self.name] = 1
- output("int tolua_is" .. string.gsub(self.name,"::","_") .. " (lua_State* L, int lo, const char * type, int def, tolua_Error* err)")
+ output("int tolua_is" .. string.gsub(self.name,"::","_") .. " (lua_State* L, int lo, int def, tolua_Error* err)")
output("{")
output("if (!tolua_isnumber(L,lo,def,err)) return 0;")
output("lua_Number val = tolua_tonumber(L,lo,def);")
@@ -134,7 +134,7 @@ function Enumerate (n,b,varname)
e.min = min
e.max = max
if n ~= "" then
- _enums[n] = 1
+ _enums[n] = true
Typedef("int "..n)
end
return _Enumerate(e, varname)
diff --git a/lib/tolua++/src/bin/lua/function.lua b/lib/tolua++/src/bin/lua/function.lua
index ad1ab4225..3b6b53c5e 100644
--- a/lib/tolua++/src/bin/lua/function.lua
+++ b/lib/tolua++/src/bin/lua/function.lua
@@ -58,7 +58,7 @@ function classFunction:supcode (local_constructor)
if self.args[1].type ~= 'void' then
local i=1
while self.args[i] do
- if isenum(self.args[i].type) then
+ if isenumtype(self.args[i].type) then
emitenumprototype(self.args[i].type)
end
i = i+1