Function variable is a table

Hi,

Sorry this is a super simple question but I just can’t work it out or find why its not working.

The variable I have in my function doesn’t print it’s value it prints table: 0x6c0730.

Here is the code…
–showwebpopup.lua
module(…, package.seeall)
function changeWebPopup(file)
print(file)
end
–menu.lua
local showwebpopup = require (“showwebpopup”)
showwebpopup:changeWebPopup(“home”)

I would expect that this should print “home” to the console but instead prints table: 0x4c93b0.

[import]uid: 51622 topic_id: 9508 reply_id: 309508[/import]

You will want to use showwebpopup.changeWebPopup("home")

Because you are currently using a colon the first argument is actually the module. [import]uid: 5833 topic_id: 9508 reply_id: 34752[/import]

ah good spot that’s a subtle bug. In Lua the colon is syntactic sugar for passing the object itself as the first argument; it’s the same thing as writing:

showwebpopup.changeWebPopup(showwebpopup, “home”)

It’s kind of annoying that Lua doesn’t return an error for incorrect number of arguments. [import]uid: 12108 topic_id: 9508 reply_id: 34775[/import]

Sorry yea I was in a rush so I probably should have explained it a bit better, thank you for clearing that up for me. [import]uid: 5833 topic_id: 9508 reply_id: 34780[/import]

Thanks alot. Frustrating newbie error!! [import]uid: 51622 topic_id: 9508 reply_id: 34785[/import]