Browse Source

Merge pull request #440 from FungusGames/stringtable-unity

Moved stringtable to unity table
master
Chris Gregan 9 years ago
parent
commit
1659f201ba
  1. 6
      Assets/Fungus/Lua/Scripts/LuaUtils.cs
  2. 2
      Assets/Tests/Lua/FungusTests.unity
  3. 8
      Assets/Tests/Lua/LuaEnvironmentTests.unity

6
Assets/Fungus/Lua/Scripts/LuaUtils.cs

@ -175,7 +175,11 @@ namespace Fungus
if (stringTableRes.Type == DataType.Table)
{
stringTableCached = stringTableRes.Table;
interpreter.Globals["stringtable"] = stringTableCached;
Table unityTable = interpreter.Globals.Get("unity").Table;
if (unityTable != null)
{
unityTable["stringtable"] = stringTableCached;
}
}
}
catch (ScriptRuntimeException ex)

2
Assets/Tests/Lua/FungusTests.unity

@ -956,7 +956,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &110417826
MonoBehaviour:
m_ObjectHideFlags: 0

8
Assets/Tests/Lua/LuaEnvironmentTests.unity

@ -1369,7 +1369,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &1532103953
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1622,14 +1622,14 @@ MonoBehaviour:
luaFile: {fileID: 0}
luaScript: '-- Test string table localisation system
fungus.assert(stringtable != nil)
fungus.assert(unity.stringtable != nil)
-- Check string table loaded ok
fungus.assert(stringtable.hello.en == "Hi there")
fungus.assert(unity.stringtable.hello.en == "Hi there")
fungus.assert(stringtable.hello.fr == "Bonjour")
fungus.assert(unity.stringtable.hello.fr == "Bonjour")
-- Check getstring()

Loading…
Cancel
Save