summaryrefslogtreecommitdiff
path: root/Lib/lua/luaruntime.swg
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2014-02-27 20:04:08 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2014-02-27 20:04:08 +0000
commit1be97ed26cb284ad1ff52ad2289209f7a79c6f67 (patch)
tree753f8421bad7316d9f64379b90271ca7882e765b /Lib/lua/luaruntime.swg
parent3aa689d276158fc89921d98ee928cfb68465b943 (diff)
parentc6dd6b0726342b32579a0b6467128804581b9f92 (diff)
downloadswig-1be97ed26cb284ad1ff52ad2289209f7a79c6f67.tar.gz
Merge Lua changes - branch 'class_p1' of github.com:v-for-vandal/swig into v-for-vandal-class_p1
* 'class_p1' of github.com:v-for-vandal/swig: Fixing registerClass. No more wrap: unnecessary attributes Fixed registerMethod to work like registerVariable Switched to Swig_name_* functions Return MIN_OPT_LEVEL for elua add nspace_extend test case updated documentation following comd options renaming Options in alphabetical order Members renaming target_name -> lua_name Fixing cmd options, again Fixing segfault Removed class_parent_nspace Fixes to module options Rename methods to make it clear what 'symbols table' they operate on. Small documenation fixes Updating Lua documentation Eliminating namespaces_hash and using symbols table instead Attempt to catch unreproducable bug from Travis CI build Small bugfixes Bugfixes for eLua. eLua emulation mode Add compatibility option for old-style inheritance Add support for C-style enums in C mode. And tests. Style fixes. Comments fixes. Fixing cmd options. etc Some fixes for elua Attempt to fix unreproducable bug (from Travis CI build) Fixes for examples. Wrapped keywords into guardian in keyword_rename test Remove some typos Remove some obsolete code Manually beautifying luarun.swg Code beautifier Valuewrapper test Removing obsolete debug code Bugfixes A few bugfixes Some class bases iteration improvements Fixes for elua Bugfixes Bugfixes. CMD args handling. Code cleanup Bugfixes Preparations before pull request - part 1 More changes. Mostly to the would-be class library Fixing issuse with v2-compatible static function names Add pointer guard Add runtime test Bugfixes nspace.i example is working Initial implementation - everything compiles but might not work
Diffstat (limited to 'Lib/lua/luaruntime.swg')
-rw-r--r--Lib/lua/luaruntime.swg40
1 files changed, 24 insertions, 16 deletions
diff --git a/Lib/lua/luaruntime.swg b/Lib/lua/luaruntime.swg
index 3ca489ffa..ebb997897 100644
--- a/Lib/lua/luaruntime.swg
+++ b/Lib/lua/luaruntime.swg
@@ -36,20 +36,10 @@ SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
SWIG_PropagateClientData();
#endif
-#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
+#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) || defined(SWIG_LUA_ELUA_EMULATE)
/* add a global fn */
SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
- /* begin the module (its a table with the same name as the module) */
- SWIG_Lua_module_begin(L,SWIG_name);
- /* add commands/functions */
- for (i = 0; swig_commands[i].name; i++){
- SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func);
- }
- /* add variables */
- for (i = 0; swig_variables[i].name; i++){
- SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set);
- }
#endif
#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
@@ -59,17 +49,35 @@ SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */
SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
}
}
- /* additional registration structs & classes in lua */
+ int globalRegister = 0;
+#ifdef SWIG_LUA_MODULE_GLOBAL
+ globalRegister = 1;
+#endif
+
+
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
+ SWIG_Lua_namespace_register(L,&swig___Module, globalRegister);
+#endif
+
+#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
for (i = 0; swig_types[i]; i++){
if (swig_types[i]->clientdata){
- SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata));
+ SWIG_Lua_elua_class_register_instance(L,(swig_lua_class*)(swig_types[i]->clientdata));
}
}
#endif
-#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC))
- /* constants */
- SWIG_Lua_InstallConstants(L,swig_constants);
+#if defined(SWIG_LUA_ELUA_EMULATE)
+ lua_newtable(L);
+ SWIG_Lua_elua_emulate_register(L,swig___Module.ns_methods);
+ SWIG_Lua_elua_emulate_register_clear(L);
+ if(globalRegister) {
+ lua_pushstring(L,swig___Module.name);
+ lua_pushvalue(L,-2);
+ lua_rawset(L,-4);
+ }
+#endif
+
#endif
#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)