jetlogan
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1423 |
|
|
| 24 Nov 2013 01:04 PM |
function check() return "ready" end
_G.Screen = {check = function() check() end}
print(_G.Screen.check())
I haven't played around with this in a long time, no excuse me if this is the a simple question, but how come it isn't print anything and giving me no errors? |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 24 Nov 2013 01:08 PM |
| Because you are defining check and calling it within a local scope of the global scope, it turns out check() just recursively calls itself. Name the local function 'check' outside of the table something else. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
| |
|
jetlogan
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1423 |
|
|
| 24 Nov 2013 01:11 PM |
| @Ab I did your thing and it still didn't work. |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
| |
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 24 Nov 2013 01:12 PM |
Like so:
local check0 = function() return 'ready' end
_G.Screen = {check = function() return check0() end}
print(_G.Screen.check()) |
|
|
| Report Abuse |
|
|