mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
init global string table, See issue #331
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "lauxlib.h"
|
#include "lauxlib.h"
|
||||||
#include "lualib.h"
|
#include "lualib.h"
|
||||||
|
#include "lstring.h"
|
||||||
|
|
||||||
|
|
||||||
#if !defined(LUA_PROMPT)
|
#if !defined(LUA_PROMPT)
|
||||||
@@ -596,7 +597,9 @@ static int pmain (lua_State *L) {
|
|||||||
|
|
||||||
int main (int argc, char **argv) {
|
int main (int argc, char **argv) {
|
||||||
int status, result;
|
int status, result;
|
||||||
lua_State *L = luaL_newstate(); /* create state */
|
lua_State *L;
|
||||||
|
luaS_initshr(); /* init global short string table */
|
||||||
|
L = luaL_newstate(); /* create state */
|
||||||
if (L == NULL) {
|
if (L == NULL) {
|
||||||
l_message(argv[0], "cannot create state: not enough memory");
|
l_message(argv[0], "cannot create state: not enough memory");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "lobject.h"
|
#include "lobject.h"
|
||||||
#include "lstate.h"
|
#include "lstate.h"
|
||||||
#include "lundump.h"
|
#include "lundump.h"
|
||||||
|
#include "lstring.h"
|
||||||
|
|
||||||
static void PrintFunction(const Proto* f, int full);
|
static void PrintFunction(const Proto* f, int full);
|
||||||
#define luaU_print PrintFunction
|
#define luaU_print PrintFunction
|
||||||
@@ -195,6 +196,7 @@ int main(int argc, char* argv[])
|
|||||||
int i=doargs(argc,argv);
|
int i=doargs(argc,argv);
|
||||||
argc-=i; argv+=i;
|
argc-=i; argv+=i;
|
||||||
if (argc<=0) usage("no input files given");
|
if (argc<=0) usage("no input files given");
|
||||||
|
luaS_initshr();
|
||||||
L=luaL_newstate();
|
L=luaL_newstate();
|
||||||
if (L==NULL) fatal("cannot create state: not enough memory");
|
if (L==NULL) fatal("cannot create state: not enough memory");
|
||||||
lua_pushcfunction(L,&pmain);
|
lua_pushcfunction(L,&pmain);
|
||||||
|
|||||||
Reference in New Issue
Block a user