diff options
author | David Walter Seikel | 2014-03-31 20:17:04 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-03-31 20:17:04 +1000 |
commit | ba800f3c2230b64faac814947222c364fbff6e85 (patch) | |
tree | fc8e53cf80fdcf9a1f56c6cd677dade03f2d0dcc | |
parent | More Stuff notes. (diff) | |
download | SledjHamr-ba800f3c2230b64faac814947222c364fbff6e85.zip SledjHamr-ba800f3c2230b64faac814947222c364fbff6e85.tar.gz SledjHamr-ba800f3c2230b64faac814947222c364fbff6e85.tar.bz2 SledjHamr-ba800f3c2230b64faac814947222c364fbff6e85.tar.xz |
Finally found a decent use for __call. lol
-rw-r--r-- | ClientHamr/GuiLua/skang.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index f203a83..da89792 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua | |||
@@ -311,6 +311,18 @@ Other Thing things are - | |||
311 | NOTE that skang.thing{} doesn't care what other names you pass in, they all get assigned to the thing. | 311 | NOTE that skang.thing{} doesn't care what other names you pass in, they all get assigned to the thing. |
312 | 312 | ||
313 | 313 | ||
314 | Maybe I can rename this to thingasm? B-) | ||
315 | Then widget becomes skang? | ||
316 | local thingasm = require 'thingasm' | ||
317 | thingasm('foo', 'help text) -- In this case the surrounding Lua environment becomes the module of foo. | ||
318 | -- If the first argument (or first in the table) is a string, then it's this form. | ||
319 | -- All others include the module as the first argument, which would be a table. | ||
320 | foo:('bar', 'some help', types='table') -- And now foo is the module. | ||
321 | foo.bar:{'baz', types='Stuff'} -- thingasm({foo.bar, 'baz', ...}) | ||
322 | foo.bar.baz:{'field0'} -- thingasm({foo.bar.baz, 'field0'}) | ||
323 | foo.bar.baz:{'field1'} | ||
324 | |||
325 | |||
314 | Widget - | 326 | Widget - |
315 | Merging widgets might work to. B-) | 327 | Merging widgets might work to. B-) |
316 | This does make the entire "Things with the same name link automatically" deal work easily, since they ARE the same Thing. | 328 | This does make the entire "Things with the same name link automatically" deal work easily, since they ARE the same Thing. |