Browse Source

Update Lua code.

Aster Jian 12 years ago
parent
commit
ed04210c55
2 changed files with 10 additions and 11 deletions
  1. 4 4
      Bin/Data/LuaScripts/02_HelloGUI.lua
  2. 6 7
      Bin/Data/LuaScripts/Utilities/Network.lua

+ 4 - 4
Bin/Data/LuaScripts/02_HelloGUI.lua

@@ -85,8 +85,8 @@ function InitWindow()
 
 
     -- Create the Window title Text
     -- Create the Window title Text
     local windowTitle = Text:new(context)
     local windowTitle = Text:new(context)
-    windowTitle:SetName("WindowTitle")
-    windowTitle:SetText("Hello GUI!")
+    windowTitle.name = "WindowTitle"
+    windowTitle.text = "Hello GUI!"
     
     
     
     
     -- Create the Window's close button
     -- Create the Window's close button
@@ -132,9 +132,9 @@ function HandleControlClicked(eventType, eventData)
     local name = "...?"
     local name = "...?"
     if clicked ~= nil then
     if clicked ~= nil then
         -- Get the name of the control that was clicked
         -- Get the name of the control that was clicked
-        name = clicked:GetName():CString()
+        name = clicked.name
     end
     end
 
 
     -- Update the Window's title text
     -- Update the Window's title text
-    windowTitle:SetText("Hello " .. name .. "!")
+    windowTitle.text = "Hello " .. name .. "!"
 end
 end

+ 6 - 7
Bin/Data/LuaScripts/Utilities/Network.lua

@@ -1,5 +1,5 @@
 runServer = false
 runServer = false
-runClient = false
+runClient = true
 serverAddress = ''
 serverAddress = ''
 serverPort = 1234
 serverPort = 1234
 userName = ''
 userName = ''
@@ -8,10 +8,9 @@ nobgm = false
 function ParseNetworkArguments()
 function ParseNetworkArguments()
     local index = 0
     local index = 0
     local arguments = GetArguments()
     local arguments = GetArguments()
-    for i = 1, arguments:Size() do
-        local argument = arguments[i-1]
-        if argument:Substring(0,1):CString() ~= '-' then
-            if argument:Equals("server") then
+    for i, argument in ipairs(arguments) do
+        if string.sub(argument, 1, 1) ~= '-'  then
+            if argument == "server" then
                 runServer = true
                 runServer = true
                 runClient = false
                 runClient = false
                 return
                 return
@@ -23,8 +22,8 @@ function ParseNetworkArguments()
             end
             end
             index = index + 1
             index = index + 1
         else
         else
-            argument = argument:Substring(1):ToLower()
-            if argument:Equals("nobgm") then
+            argument = string.lower(string.sub(argument, 2))
+            if argument == "nobgm" then
                 nobgm = true
                 nobgm = true
             end
             end
         end
         end