Lua Scream: Difference between revisions
From Spring
Jump to navigationJump to search
| Line 3: | Line 3: | ||
( ) -> nil | ( ) -> nil | ||
<font color="darkgreen">This creates an userdata object, | <font color="darkgreen">This creates an userdata object, which calls a special | ||
user-defined function, when the object gets destroyed | |||
(->garbage collector). | |||
You use it like the follow:</font> | |||
'''local myScream = Script.CreateScream()''' | |||
'''myScream.func = function() Spring.Echo("AHHHHHH") end''' | |||
Revision as of 20:15, 17 March 2008
Scream UserData Object
Script.CreateScream
( ) -> nil
This creates an userdata object, which calls a special user-defined function, when the object gets destroyed (->garbage collector). You use it like the follow:
local myScream = Script.CreateScream()
myScream.func = function() Spring.Echo("AHHHHHH") end