+Xira Posted January 2, 2018 Share Posted January 2, 2018 I'm creating a Wherigo using Urwigo. One of the structures I'm using is an array of 10 functions. It works fine in the emulator, on webwigo, and WhereYouGo on Android. It doesn't work on apple devices. The test Lua code is provided below and I've attached output screenshots. In the code, vProgress is a Urwigo variable initialized to "xxxxxxxxxx". What seems to be happening is that, on an Apple device, the only entry in the function array that can be accessed is the first one. What the player sees are 9 Lua Alerts that say "Don't know how to call '<null>'". I've tested a simpler array using the same constants. The entries in that array can be accessed just fine so is it a problem with having functions as array entries? Can anyone give me any insight into why this is happening? Thank you. ====================================== cBench = 4 cBlocks = 7 cCavity = 3 cSquirrels = 2 cGap = 9 cReturn = 1 cRoot = 5 cRoad = 10 cWart = 6 cWeird = 8 CR = [[ ]] function DoTest() -- this works on emulator, webwigo, and android. it does not work on iphone GetX = { [cBench] = function() return tonumber(string.sub(tostring(Player.ObjectLocation.latitude),6,6)) end, [cBlocks] = function() return tonumber(string.sub(tostring(Player.ObjectLocation.longitude),6,6)) end, [cCavity] = function() return tonumber(string.sub(tostring(Player.ObjectLocation.longitude),7,7)) end, [cSquirrels] = function() return tonumber(string.sub(tostring(Player.ObjectLocation.latitude),5,5)) end, [cGap] = function() return tonumber(string.sub(tostring(Player.ObjectLocation.latitude),4,4)) end, [cReturn] = function() return tonumber(string.sub(tostring(Player.ObjectLocation.latitude),4,4)) end, [cRoot] = function() return tonumber(string.sub(tostring(Player.ObjectLocation.longitude),7,7)) end, [cRoad] = function() return tonumber(string.sub(tostring(Player.ObjectLocation.longitude),2,2)) end, [cWart] = function() return tonumber(string.sub(tostring(Player.ObjectLocation.longitude),5,5)) end, [cWeird] = function() return tonumber(string.sub(tostring(Player.ObjectLocation.longitude),7,7)) end } debugstr="" for i = 1,10 do debugstr = debugstr.."i"..i.." " x = GetX() debugstr = debugstr .. x.. " " newStr = string.sub(vProgress,1,i-1)..x..string.sub(vProgress,i+1) vProgress = newStr end -- a check to see if the constants actually have the values I expect them to have local Cstring = cBench.." "..cBlocks.." "..cCavity.." ".. cSquirrels.." ".. cGap.." ".. cReturn.." ".. cRoot.." ".. cRoad.." ".. cWart.." ".. cWeird local outputstr = "The constants: "..Cstring..CR..CR outputstr = outputstr.."debugstr: "..debugstr..CR..CR outputstr = outputstr.."vProgress: "..vProgress Wherigo.MessageBox{Text = outputstr} end 1 Quote Link to comment
+JakeDot Posted January 4, 2018 Share Posted January 4, 2018 (edited) I have this problem as well in a cartridge and couldn't figure out why it was happening, because I don't own an iPhone... If it turns out this is the reason, thank you for describing the problem! I'll try using a local variable like for i = 1,10 do local f = GetX[i] f() end and see if that helps! ------- Well, unfortunately my changes didn't only not fix it, but apparently caused an infinite loop with the Quote Don't know how to call '<null>' messages... I'm confused... Edited January 4, 2018 by JakeDot Quote Link to comment
+charlenni Posted January 29, 2018 Share Posted January 29, 2018 The iPhone player doesn't have a complete Lua implementation, so don't expect all things working Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.