|
Lines 389-395
Link Here
|
| 389 |
* It creates the correspoding metatable in the registry, for both 'type' and 'const type'. |
389 |
* It creates the correspoding metatable in the registry, for both 'type' and 'const type'. |
| 390 |
* It maps 'const type' as being also a 'type' |
390 |
* It maps 'const type' as being also a 'type' |
| 391 |
*/ |
391 |
*/ |
| 392 |
TOLUA_API void tolua_usertype (lua_State* L, char* type) |
392 |
TOLUA_API void tolua_usertype (lua_State* L, const char* type) |
| 393 |
{ |
393 |
{ |
| 394 |
char ctype[128] = "const "; |
394 |
char ctype[128] = "const "; |
| 395 |
strncat(ctype,type,120); |
395 |
strncat(ctype,type,120); |
|
Lines 403-409
Link Here
|
| 403 |
/* Begin module |
403 |
/* Begin module |
| 404 |
* It pushes the module (or class) table on the stack |
404 |
* It pushes the module (or class) table on the stack |
| 405 |
*/ |
405 |
*/ |
| 406 |
TOLUA_API void tolua_beginmodule (lua_State* L, char* name) |
406 |
TOLUA_API void tolua_beginmodule (lua_State* L, const char* name) |
| 407 |
{ |
407 |
{ |
| 408 |
if (name) |
408 |
if (name) |
| 409 |
{ |
409 |
{ |
|
Lines 426-432
Link Here
|
| 426 |
* It creates a new module |
426 |
* It creates a new module |
| 427 |
*/ |
427 |
*/ |
| 428 |
#if 1 |
428 |
#if 1 |
| 429 |
TOLUA_API void tolua_module (lua_State* L, char* name, int hasvar) |
429 |
TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar) |
| 430 |
{ |
430 |
{ |
| 431 |
if (name) |
431 |
if (name) |
| 432 |
{ |
432 |
{ |
|
Lines 462-468
Link Here
|
| 462 |
lua_pop(L,1); /* pop module */ |
462 |
lua_pop(L,1); /* pop module */ |
| 463 |
} |
463 |
} |
| 464 |
#else |
464 |
#else |
| 465 |
TOLUA_API void tolua_module (lua_State* L, char* name, int hasvar) |
465 |
TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar) |
| 466 |
{ |
466 |
{ |
| 467 |
if (name) |
467 |
if (name) |
| 468 |
{ |
468 |
{ |
|
Lines 518-524
Link Here
|
| 518 |
/* Map C class |
518 |
/* Map C class |
| 519 |
* It maps a C class, setting the appropriate inheritance and super classes. |
519 |
* It maps a C class, setting the appropriate inheritance and super classes. |
| 520 |
*/ |
520 |
*/ |
| 521 |
TOLUA_API void tolua_cclass (lua_State* L, char* lname, char* name, char* base, lua_CFunction col) |
521 |
TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col) |
| 522 |
{ |
522 |
{ |
| 523 |
char cname[128] = "const "; |
523 |
char cname[128] = "const "; |
| 524 |
char cbase[128] = "const "; |
524 |
char cbase[128] = "const "; |
|
Lines 577-583
Link Here
|
| 577 |
/* Map function |
577 |
/* Map function |
| 578 |
* It assigns a function into the current module (or class) |
578 |
* It assigns a function into the current module (or class) |
| 579 |
*/ |
579 |
*/ |
| 580 |
TOLUA_API void tolua_function (lua_State* L, char* name, lua_CFunction func) |
580 |
TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func) |
| 581 |
{ |
581 |
{ |
| 582 |
lua_pushstring(L,name); |
582 |
lua_pushstring(L,name); |
| 583 |
lua_pushcfunction(L,func); |
583 |
lua_pushcfunction(L,func); |
|
Lines 600-606
Link Here
|
| 600 |
/* Map constant number |
600 |
/* Map constant number |
| 601 |
* It assigns a constant number into the current module (or class) |
601 |
* It assigns a constant number into the current module (or class) |
| 602 |
*/ |
602 |
*/ |
| 603 |
TOLUA_API void tolua_constant (lua_State* L, char* name, double value) |
603 |
TOLUA_API void tolua_constant (lua_State* L, const char* name, double value) |
| 604 |
{ |
604 |
{ |
| 605 |
lua_pushstring(L,name); |
605 |
lua_pushstring(L,name); |
| 606 |
tolua_pushnumber(L,value); |
606 |
tolua_pushnumber(L,value); |
|
Lines 611-617
Link Here
|
| 611 |
/* Map variable |
611 |
/* Map variable |
| 612 |
* It assigns a variable into the current module (or class) |
612 |
* It assigns a variable into the current module (or class) |
| 613 |
*/ |
613 |
*/ |
| 614 |
TOLUA_API void tolua_variable (lua_State* L, char* name, lua_CFunction get, lua_CFunction set) |
614 |
TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set) |
| 615 |
{ |
615 |
{ |
| 616 |
/* get func */ |
616 |
/* get func */ |
| 617 |
lua_pushstring(L,".get"); |
617 |
lua_pushstring(L,".get"); |
|
Lines 663-669
Link Here
|
| 663 |
/* Map an array |
663 |
/* Map an array |
| 664 |
* It assigns an array into the current module (or class) |
664 |
* It assigns an array into the current module (or class) |
| 665 |
*/ |
665 |
*/ |
| 666 |
TOLUA_API void tolua_array (lua_State* L, char* name, lua_CFunction get, lua_CFunction set) |
666 |
TOLUA_API void tolua_array (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set) |
| 667 |
{ |
667 |
{ |
| 668 |
lua_pushstring(L,".get"); |
668 |
lua_pushstring(L,".get"); |
| 669 |
lua_rawget(L,-2); |
669 |
lua_rawget(L,-2); |