Lua Scream: Difference between revisions

From Spring
Jump to navigationJump to search
JK (talk | contribs)
JK (talk | contribs)
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
  you can attach any variable to it (use it as a table).
   user-defined function, when the object gets destroyed
   The difference from a normal table is that the object
  (->garbage collector).
  calls the Scream() function of the object (if it exists)
  You use it like the follow:</font>
  when the object gets destroyed (->garbage collector).</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