Lua Scream: Difference between revisions

From Spring
Jump to navigationJump to search
JK (talk | contribs)
mNo edit summary
Koshi (talk | contribs)
fix category
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[Engine_Development|Development]] < [[Lua_Scripting|Lua Scripting]] < {{FULLPAGENAME}}
== Scream UserData Object ==
== Scream UserData Object ==
'''Script.CreateScream'''
'''Script.CreateScream'''
   ( ) -> nil
   ( ) -> userdata scream
   <font color="darkgreen">This creates an userdata object,
 
  you can attach any variable to it (use it as a table).
   <font color="#55ee99">This creates an userdata object, which calls a special
   The difference from a normal table is that the object
   user-defined function, when the object gets destroyed
  calls the Scream() function of the object (if it exists)
  (->garbage collector).
  when the object gets destroyed (->garbage collector).</font>
  You use it like the follow:</font>
 
  '''local myScream = Script.CreateScream()'''
  '''myScream.func  = function() Spring.Echo("AHHHHHH") end'''
 
[[category: Lua]]

Latest revision as of 11:50, 13 March 2010

Development < Lua Scripting < Lua Scream

Scream UserData Object

Script.CreateScream

 ( ) -> userdata scream
 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