[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Enigma-devel] Locally Scoped Callbacks Library
From: |
Nat Pryce |
Subject: |
[Enigma-devel] Locally Scoped Callbacks Library |
Date: |
Mon, 20 Oct 2003 15:03:15 +0100 |
Some while ago somebody on this list asked how a callback function can be
passed information about the object that is calling it back. The solution
requires some pretty deep Lua magic: nested functions, upvars, and setglobal
function. All that's pretty complicated for what is a very common
requirement, so I have written a callbacks library that does all the nasty
bits for you. Using this library you can register any nested or anonymous
function as a callback and get back a global identifier that you can use as
the value of the "target" attribute of an Enigma object.
I've attached the library and a demo level to this email. The level is
pretty simple, so I don't know if it should be included in the game itself.
I wrote it as a simple demo of how to use the library but it ended up
growing into a simple puzzle anyway. I just can't stop myself sometimes!
Cheers,
Nat.
_______________________
Dr. Nathaniel Pryce
B13media Ltd.
http://www.b13media.com
+44 (0)7712 526 661
callbacks.lua
Description: Binary data
callbacks-demo.lua
Description: Binary data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Enigma-devel] Locally Scoped Callbacks Library,
Nat Pryce <=