diff options
author | David Walter Seikel | 2014-04-03 07:04:53 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-04-03 07:04:53 +1000 |
commit | 22cf268c7419eb0477d07af0c78a558ffde845fc (patch) | |
tree | 6cab7b3ee9602a6f17da769842cc00df22321a26 | |
parent | More Widget and Squeal ramblings. (diff) | |
download | SledjHamr-22cf268c7419eb0477d07af0c78a558ffde845fc.zip SledjHamr-22cf268c7419eb0477d07af0c78a558ffde845fc.tar.gz SledjHamr-22cf268c7419eb0477d07af0c78a558ffde845fc.tar.bz2 SledjHamr-22cf268c7419eb0477d07af0c78a558ffde845fc.tar.xz |
Load any matching .properties files into a module.
-rw-r--r-- | ClientHamr/GuiLua/skang.lua | 7 | ||||
-rw-r--r-- | ClientHamr/GuiLua/test.lua | 2 | ||||
-rw-r--r-- | ClientHamr/GuiLua/test.properties | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index 67df94b..d5622fd 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua | |||
@@ -141,7 +141,12 @@ end | |||
141 | 141 | ||
142 | -- Restore the environment. | 142 | -- Restore the environment. |
143 | moduleEnd = function (module) | 143 | moduleEnd = function (module) |
144 | -- TODO - Look for _NAME.properties, and load it into the modules Things. | 144 | -- See if there is a properties file, and run it in the modules environment. |
145 | local properties = loadfile(module._NAME .. '.properties') | ||
146 | if properties then | ||
147 | setfenv(properties, getfenv(2)) | ||
148 | properties() | ||
149 | end | ||
145 | -- TODO - Parse command line parameters at some point. | 150 | -- TODO - Parse command line parameters at some point. |
146 | -- http://stackoverflow.com/questions/3745047/help-locate-c-sample-code-to-read-lua-command-line-arguments | 151 | -- http://stackoverflow.com/questions/3745047/help-locate-c-sample-code-to-read-lua-command-line-arguments |
147 | if module.isLua then setfenv(2, module.savedEnvironment) end | 152 | if module.isLua then setfenv(2, module.savedEnvironment) end |
diff --git a/ClientHamr/GuiLua/test.lua b/ClientHamr/GuiLua/test.lua index 9de7082..4ddbc1d 100644 --- a/ClientHamr/GuiLua/test.lua +++ b/ClientHamr/GuiLua/test.lua | |||
@@ -27,7 +27,7 @@ this.func(1, 'two') | |||
27 | print('code') | 27 | print('code') |
28 | 28 | ||
29 | -- A variable that is private to this module. | 29 | -- A variable that is private to this module. |
30 | local fool | 30 | local fool = 22 |
31 | 31 | ||
32 | -- TODO - Could have a table of tables, and ipair through the top level, passing the inner ones to skang.thingasm{}. | 32 | -- TODO - Could have a table of tables, and ipair through the top level, passing the inner ones to skang.thingasm{}. |
33 | 33 | ||
diff --git a/ClientHamr/GuiLua/test.properties b/ClientHamr/GuiLua/test.properties index 81bdff0..d6d29cb 100644 --- a/ClientHamr/GuiLua/test.properties +++ b/ClientHamr/GuiLua/test.properties | |||
@@ -1 +1 @@ | |||
test.foo = 'forty two' | foo = 'forty two' | ||