Skip to content

Commit

Permalink
修正 ILuaAPI.ToString() 的实现错误
Browse files Browse the repository at this point in the history
fix #34
  • Loading branch information
xebecnan committed Jun 11, 2014
1 parent 9e7baff commit a650d49
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions Assets/StreamingAssets/LuaRoot/framework/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ end

local function start()
print("---- start ----")

print(table.concat{"hello", ":", "UniLua"})

local a = 10
local b = tostring(a)
print(type(a), type(b))

SceneMgr.init_scene()
end

Expand Down
12 changes: 8 additions & 4 deletions Assets/UniLua/LuaAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1404,12 +1404,16 @@ string ILuaAPI.ToString( int index )
if(addr.V.TtIsString()) {
return addr.V.OValue as string;
}
else if(addr.V.TtIsNumber()) {
return addr.V.NValue.ToString();
}
else {

if(!V_ToString(ref addr.V)) {
return null;
}

if( !Index2Addr( index, out addr ) )
return null;

Utl.Assert(addr.V.TtIsString());
return addr.V.OValue as string;
}

double ILuaAPI.ToNumberX( int index, out bool isnum )
Expand Down

0 comments on commit a650d49

Please sign in to comment.