Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 10, 2008, 4:28:51 PM (17 years ago)
Author:
bknecht
Message:

You can now use lua tags everywhere in the XML file you want: It'll work. Even wrongly put tags are corrected now. Read the wikipages about scripting to see how you can use it.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • code/branches/script/src/util/tolua/tolua_bind.cc

    r999 r1019  
    11/*
    2 ** Lua binding: script
    3 ** Generated automatically by tolua++-1.0.92 on Sat Apr  5 20:29:18 2008.
     2** Lua binding: orxonox
     3** Generated automatically by tolua++-1.0.92 on Sun Apr  6 15:44:17 2008.
    44*/
    55
     
    1212
    1313/* Exported function */
    14 TOLUA_API int  tolua_script_open (lua_State* tolua_S);
     14TOLUA_API int  tolua_orxonox_open (lua_State* tolua_S);
    1515
    16 #include "Script.h"
    17 
    18 /* function to release collected object via destructor */
    19 #ifdef __cplusplus
    20 
    21 static int tolua_collect_orxonox__Script (lua_State* tolua_S)
    22 {
    23  orxonox::Script* self = (orxonox::Script*) tolua_tousertype(tolua_S,1,0);
    24         Mtolua_delete(self);
    25         return 0;
    26 }
    27 #endif
    28 
     16#include "../../orxonox/core/Script.h"
    2917
    3018/* function to register type */
     
    3422}
    3523
    36 /* method: new of class  orxonox::Script */
    37 #ifndef TOLUA_DISABLE_tolua_script_orxonox_Script_new00
    38 static int tolua_script_orxonox_Script_new00(lua_State* tolua_S)
     24/* method: getInstance of class  orxonox::Script */
     25#ifndef TOLUA_DISABLE_tolua_orxonox_orxonox_Script_getInstance00
     26static int tolua_orxonox_orxonox_Script_getInstance00(lua_State* tolua_S)
    3927{
    4028#ifndef TOLUA_RELEASE
     
    4937 {
    5038  {
    51    orxonox::Script* tolua_ret = (orxonox::Script*)  Mtolua_new((orxonox::Script)());
     39   orxonox::Script* tolua_ret = (orxonox::Script*)  orxonox::Script::getInstance();
    5240    tolua_pushusertype(tolua_S,(void*)tolua_ret,"orxonox::Script");
    5341  }
     
    5644#ifndef TOLUA_RELEASE
    5745 tolua_lerror:
    58  tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
    59  return 0;
    60 #endif
    61 }
    62 #endif //#ifndef TOLUA_DISABLE
    63 
    64 /* method: new_local of class  orxonox::Script */
    65 #ifndef TOLUA_DISABLE_tolua_script_orxonox_Script_new00_local
    66 static int tolua_script_orxonox_Script_new00_local(lua_State* tolua_S)
    67 {
    68 #ifndef TOLUA_RELEASE
    69  tolua_Error tolua_err;
    70  if (
    71      !tolua_isusertable(tolua_S,1,"orxonox::Script",0,&tolua_err) ||
    72      !tolua_isnoobj(tolua_S,2,&tolua_err)
    73  )
    74   goto tolua_lerror;
    75  else
    76 #endif
    77  {
    78   {
    79    orxonox::Script* tolua_ret = (orxonox::Script*)  Mtolua_new((orxonox::Script)());
    80     tolua_pushusertype(tolua_S,(void*)tolua_ret,"orxonox::Script");
    81     tolua_register_gc(tolua_S,lua_gettop(tolua_S));
    82   }
    83  }
    84  return 1;
    85 #ifndef TOLUA_RELEASE
    86  tolua_lerror:
    87  tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
     46 tolua_error(tolua_S,"#ferror in function 'getInstance'.",&tolua_err);
    8847 return 0;
    8948#endif
     
    9251
    9352/* method: luaPrint of class  orxonox::Script */
    94 #ifndef TOLUA_DISABLE_tolua_script_orxonox_Script_luaPrint00
    95 static int tolua_script_orxonox_Script_luaPrint00(lua_State* tolua_S)
     53#ifndef TOLUA_DISABLE_tolua_orxonox_orxonox_Script_luaPrint00
     54static int tolua_orxonox_orxonox_Script_luaPrint00(lua_State* tolua_S)
    9655{
    9756#ifndef TOLUA_RELEASE
     
    9958 if (
    10059     !tolua_isusertype(tolua_S,1,"orxonox::Script",0,&tolua_err) ||
    101      !tolua_isstring(tolua_S,2,0,&tolua_err) ||
     60     !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
    10261     !tolua_isnoobj(tolua_S,3,&tolua_err)
    10362 )
     
    10766 {
    10867  orxonox::Script* self = (orxonox::Script*)  tolua_tousertype(tolua_S,1,0);
    109   char* str = ((char*)  tolua_tostring(tolua_S,2,0));
     68  std::string str = ((std::string)  tolua_tocppstring(tolua_S,2,0));
    11069#ifndef TOLUA_RELEASE
    11170  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'luaPrint'",NULL);
     
    12584
    12685/* Open function */
    127 TOLUA_API int tolua_script_open (lua_State* tolua_S)
     86TOLUA_API int tolua_orxonox_open (lua_State* tolua_S)
    12887{
    12988 tolua_open(tolua_S);
     
    13392  tolua_module(tolua_S,"orxonox",0);
    13493  tolua_beginmodule(tolua_S,"orxonox");
    135    #ifdef __cplusplus
    136    tolua_cclass(tolua_S,"Script","orxonox::Script","",tolua_collect_orxonox__Script);
    137    #else
    13894   tolua_cclass(tolua_S,"Script","orxonox::Script","",NULL);
    139    #endif
    14095   tolua_beginmodule(tolua_S,"Script");
    141     tolua_function(tolua_S,"new",tolua_script_orxonox_Script_new00);
    142     tolua_function(tolua_S,"new_local",tolua_script_orxonox_Script_new00_local);
    143     tolua_function(tolua_S,".call",tolua_script_orxonox_Script_new00_local);
    144     tolua_function(tolua_S,"luaPrint",tolua_script_orxonox_Script_luaPrint00);
     96    tolua_function(tolua_S,"getInstance",tolua_orxonox_orxonox_Script_getInstance00);
     97    tolua_function(tolua_S,"luaPrint",tolua_orxonox_orxonox_Script_luaPrint00);
    14598   tolua_endmodule(tolua_S);
    14699  tolua_endmodule(tolua_S);
     
    151104
    152105#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
    153  TOLUA_API int luaopen_script (lua_State* tolua_S) {
    154  return tolua_script_open(tolua_S);
     106 TOLUA_API int luaopen_orxonox (lua_State* tolua_S) {
     107 return tolua_orxonox_open(tolua_S);
    155108};
    156109#endif
Note: See TracChangeset for help on using the changeset viewer.