diff options
Diffstat (limited to 'lbaselib.c')
-rw-r--r-- | lbaselib.c | 194 |
1 files changed, 97 insertions, 97 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.25 2001/02/22 17:15:18 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.26 2001/02/22 18:59:59 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -35,21 +35,21 @@ static int luaB__ALERT (lua_State *L) { | |||
35 | */ | 35 | */ |
36 | static int luaB__ERRORMESSAGE (lua_State *L) { | 36 | static int luaB__ERRORMESSAGE (lua_State *L) { |
37 | luaL_checktype(L, 1, LUA_TSTRING); | 37 | luaL_checktype(L, 1, LUA_TSTRING); |
38 | lua_getglobal(L, LUA_ALERT); | 38 | lua_getglobal(L, l_s(LUA_ALERT)); |
39 | if (lua_isfunction(L, -1)) { /* avoid error loop if _ALERT is not defined */ | 39 | if (lua_isfunction(L, -1)) { /* avoid error loop if _ALERT is not defined */ |
40 | lua_Debug ar; | 40 | lua_Debug ar; |
41 | lua_pushliteral(L, "error: "); | 41 | lua_pushliteral(L, l_s("error: ")); |
42 | lua_pushvalue(L, 1); | 42 | lua_pushvalue(L, 1); |
43 | if (lua_getstack(L, 1, &ar)) { | 43 | if (lua_getstack(L, 1, &ar)) { |
44 | lua_getinfo(L, "Sl", &ar); | 44 | lua_getinfo(L, l_s("Sl"), &ar); |
45 | if (ar.source && ar.currentline > 0) { | 45 | if (ar.source && ar.currentline > 0) { |
46 | char buff[100]; | 46 | l_char buff[100]; |
47 | sprintf(buff, "\n <%.70s: line %d>", ar.short_src, ar.currentline); | 47 | sprintf(buff, l_s("\n <%.70s: line %d>"), ar.short_src, ar.currentline); |
48 | lua_pushstring(L, buff); | 48 | lua_pushstring(L, buff); |
49 | lua_concat(L, 2); | 49 | lua_concat(L, 2); |
50 | } | 50 | } |
51 | } | 51 | } |
52 | lua_pushliteral(L, "\n"); | 52 | lua_pushliteral(L, l_s("\n")); |
53 | lua_concat(L, 3); | 53 | lua_concat(L, 3); |
54 | lua_rawcall(L, 1, 0); | 54 | lua_rawcall(L, 1, 0); |
55 | } | 55 | } |
@@ -66,20 +66,20 @@ static int luaB__ERRORMESSAGE (lua_State *L) { | |||
66 | static int luaB_print (lua_State *L) { | 66 | static int luaB_print (lua_State *L) { |
67 | int n = lua_gettop(L); /* number of arguments */ | 67 | int n = lua_gettop(L); /* number of arguments */ |
68 | int i; | 68 | int i; |
69 | lua_getglobal(L, "tostring"); | 69 | lua_getglobal(L, l_s("tostring")); |
70 | for (i=1; i<=n; i++) { | 70 | for (i=1; i<=n; i++) { |
71 | const char *s; | 71 | const l_char *s; |
72 | lua_pushvalue(L, -1); /* function to be called */ | 72 | lua_pushvalue(L, -1); /* function to be called */ |
73 | lua_pushvalue(L, i); /* value to print */ | 73 | lua_pushvalue(L, i); /* value to print */ |
74 | lua_rawcall(L, 1, 1); | 74 | lua_rawcall(L, 1, 1); |
75 | s = lua_tostring(L, -1); /* get result */ | 75 | s = lua_tostring(L, -1); /* get result */ |
76 | if (s == NULL) | 76 | if (s == NULL) |
77 | lua_error(L, "`tostring' must return a string to `print'"); | 77 | lua_error(L, l_s("`tostring' must return a string to `print'")); |
78 | if (i>1) fputs("\t", stdout); | 78 | if (i>1) fputs(l_s("\t"), stdout); |
79 | fputs(s, stdout); | 79 | fputs(s, stdout); |
80 | lua_pop(L, 1); /* pop result */ | 80 | lua_pop(L, 1); /* pop result */ |
81 | } | 81 | } |
82 | fputs("\n", stdout); | 82 | fputs(l_s("\n"), stdout); |
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | 85 | ||
@@ -94,14 +94,14 @@ static int luaB_tonumber (lua_State *L) { | |||
94 | } | 94 | } |
95 | } | 95 | } |
96 | else { | 96 | else { |
97 | const char *s1 = luaL_check_string(L, 1); | 97 | const l_char *s1 = luaL_check_string(L, 1); |
98 | char *s2; | 98 | l_char *s2; |
99 | unsigned long n; | 99 | unsigned long n; |
100 | luaL_arg_check(L, 2 <= base && base <= 36, 2, "base out of range"); | 100 | luaL_arg_check(L, 2 <= base && base <= 36, 2, l_s("base out of range")); |
101 | n = strtoul(s1, &s2, base); | 101 | n = strtoul(s1, &s2, base); |
102 | if (s1 != s2) { /* at least one valid digit? */ | 102 | if (s1 != s2) { /* at least one valid digit? */ |
103 | while (isspace(uchar(*s2))) s2++; /* skip trailing spaces */ | 103 | while (isspace(uchar(*s2))) s2++; /* skip trailing spaces */ |
104 | if (*s2 == '\0') { /* no invalid trailing characters? */ | 104 | if (*s2 == l_c('\0')) { /* no invalid trailing characters? */ |
105 | lua_pushnumber(L, n); | 105 | lua_pushnumber(L, n); |
106 | return 1; | 106 | return 1; |
107 | } | 107 | } |
@@ -135,14 +135,14 @@ static int gettag (lua_State *L, int narg) { | |||
135 | case LUA_TNUMBER: | 135 | case LUA_TNUMBER: |
136 | return (int)lua_tonumber(L, narg); | 136 | return (int)lua_tonumber(L, narg); |
137 | case LUA_TSTRING: { | 137 | case LUA_TSTRING: { |
138 | const char *name = lua_tostring(L, narg); | 138 | const l_char *name = lua_tostring(L, narg); |
139 | int tag = lua_type2tag(L, name); | 139 | int tag = lua_type2tag(L, name); |
140 | if (tag == LUA_TNONE) | 140 | if (tag == LUA_TNONE) |
141 | luaL_verror(L, "'%.30s' is not a valid type name", name); | 141 | luaL_verror(L, l_s("'%.30s' is not a valid type name"), name); |
142 | return tag; | 142 | return tag; |
143 | } | 143 | } |
144 | default: | 144 | default: |
145 | luaL_argerror(L, narg, "tag or type name expected"); | 145 | luaL_argerror(L, narg, l_s("tag or type name expected")); |
146 | return 0; /* to avoid warnings */ | 146 | return 0; /* to avoid warnings */ |
147 | } | 147 | } |
148 | } | 148 | } |
@@ -162,7 +162,7 @@ static int luaB_settag (lua_State *L) { | |||
162 | } | 162 | } |
163 | 163 | ||
164 | static int luaB_newtype (lua_State *L) { | 164 | static int luaB_newtype (lua_State *L) { |
165 | const char *name = luaL_opt_string(L, 1, NULL); | 165 | const l_char *name = luaL_opt_string(L, 1, NULL); |
166 | lua_pushnumber(L, lua_newtype(L, name, LUA_TTABLE)); | 166 | lua_pushnumber(L, lua_newtype(L, name, LUA_TTABLE)); |
167 | return 1; | 167 | return 1; |
168 | } | 168 | } |
@@ -199,11 +199,11 @@ static int luaB_rawset (lua_State *L) { | |||
199 | 199 | ||
200 | static int luaB_settagmethod (lua_State *L) { | 200 | static int luaB_settagmethod (lua_State *L) { |
201 | int tag = gettag(L, 1); | 201 | int tag = gettag(L, 1); |
202 | const char *event = luaL_check_string(L, 2); | 202 | const l_char *event = luaL_check_string(L, 2); |
203 | luaL_arg_check(L, lua_isfunction(L, 3) || lua_isnil(L, 3), 3, | 203 | luaL_arg_check(L, lua_isfunction(L, 3) || lua_isnil(L, 3), 3, |
204 | "function or nil expected"); | 204 | l_s("function or nil expected")); |
205 | if (strcmp(event, "gc") == 0) | 205 | if (strcmp(event, l_s("gc")) == 0) |
206 | lua_error(L, "deprecated use: cannot set the `gc' tag method from Lua"); | 206 | lua_error(L, l_s("deprecated use: cannot set the `gc' tag method from Lua")); |
207 | lua_gettagmethod(L, tag, event); | 207 | lua_gettagmethod(L, tag, event); |
208 | lua_pushvalue(L, 3); | 208 | lua_pushvalue(L, 3); |
209 | lua_settagmethod(L, tag, event); | 209 | lua_settagmethod(L, tag, event); |
@@ -213,9 +213,9 @@ static int luaB_settagmethod (lua_State *L) { | |||
213 | 213 | ||
214 | static int luaB_gettagmethod (lua_State *L) { | 214 | static int luaB_gettagmethod (lua_State *L) { |
215 | int tag = gettag(L, 1); | 215 | int tag = gettag(L, 1); |
216 | const char *event = luaL_check_string(L, 2); | 216 | const l_char *event = luaL_check_string(L, 2); |
217 | if (strcmp(event, "gc") == 0) | 217 | if (strcmp(event, l_s("gc")) == 0) |
218 | lua_error(L, "deprecated use: cannot get the `gc' tag method from Lua"); | 218 | lua_error(L, l_s("deprecated use: cannot get the `gc' tag method from Lua")); |
219 | lua_gettagmethod(L, tag, event); | 219 | lua_gettagmethod(L, tag, event); |
220 | return 1; | 220 | return 1; |
221 | } | 221 | } |
@@ -261,9 +261,9 @@ static int luaB_next (lua_State *L) { | |||
261 | 261 | ||
262 | 262 | ||
263 | static int passresults (lua_State *L, int status, int oldtop) { | 263 | static int passresults (lua_State *L, int status, int oldtop) { |
264 | static const char *const errornames[] = | 264 | static const l_char *const errornames[] = |
265 | {"ok", "run-time error", "file error", "syntax error", | 265 | {l_s("ok"), l_s("run-time error"), l_s("file error"), l_s("syntax error"), |
266 | "memory error", "error in error handling"}; | 266 | l_s("memory error"), l_s("error in error handling")}; |
267 | if (status == 0) { | 267 | if (status == 0) { |
268 | int nresults = lua_gettop(L) - oldtop; | 268 | int nresults = lua_gettop(L) - oldtop; |
269 | if (nresults > 0) | 269 | if (nresults > 0) |
@@ -283,59 +283,59 @@ static int passresults (lua_State *L, int status, int oldtop) { | |||
283 | static int luaB_dostring (lua_State *L) { | 283 | static int luaB_dostring (lua_State *L) { |
284 | int oldtop = lua_gettop(L); | 284 | int oldtop = lua_gettop(L); |
285 | size_t l; | 285 | size_t l; |
286 | const char *s = luaL_check_lstr(L, 1, &l); | 286 | const l_char *s = luaL_check_lstr(L, 1, &l); |
287 | const char *chunkname = luaL_opt_string(L, 2, s); | 287 | const l_char *chunkname = luaL_opt_string(L, 2, s); |
288 | return passresults(L, lua_dobuffer(L, s, l, chunkname), oldtop); | 288 | return passresults(L, lua_dobuffer(L, s, l, chunkname), oldtop); |
289 | } | 289 | } |
290 | 290 | ||
291 | 291 | ||
292 | static int luaB_dofile (lua_State *L) { | 292 | static int luaB_dofile (lua_State *L) { |
293 | int oldtop = lua_gettop(L); | 293 | int oldtop = lua_gettop(L); |
294 | const char *fname = luaL_opt_string(L, 1, NULL); | 294 | const l_char *fname = luaL_opt_string(L, 1, NULL); |
295 | return passresults(L, lua_dofile(L, fname), oldtop); | 295 | return passresults(L, lua_dofile(L, fname), oldtop); |
296 | } | 296 | } |
297 | 297 | ||
298 | 298 | ||
299 | static int luaB_call (lua_State *L) { | 299 | static int luaB_call (lua_State *L) { |
300 | int oldtop; | 300 | int oldtop; |
301 | const char *options = luaL_opt_string(L, 3, ""); | 301 | const l_char *options = luaL_opt_string(L, 3, l_s("")); |
302 | int err = 0; /* index of old error method */ | 302 | int err = 0; /* index of old error method */ |
303 | int i, status; | 303 | int i, status; |
304 | int n; | 304 | int n; |
305 | luaL_checktype(L, 2, LUA_TTABLE); | 305 | luaL_checktype(L, 2, LUA_TTABLE); |
306 | n = lua_getn(L, 2); | 306 | n = lua_getn(L, 2); |
307 | if (!lua_isnull(L, 4)) { /* set new error method */ | 307 | if (!lua_isnull(L, 4)) { /* set new error method */ |
308 | lua_getglobal(L, LUA_ERRORMESSAGE); | 308 | lua_getglobal(L, l_s(LUA_ERRORMESSAGE)); |
309 | err = lua_gettop(L); /* get index */ | 309 | err = lua_gettop(L); /* get index */ |
310 | lua_pushvalue(L, 4); | 310 | lua_pushvalue(L, 4); |
311 | lua_setglobal(L, LUA_ERRORMESSAGE); | 311 | lua_setglobal(L, l_s(LUA_ERRORMESSAGE)); |
312 | } | 312 | } |
313 | oldtop = lua_gettop(L); /* top before function-call preparation */ | 313 | oldtop = lua_gettop(L); /* top before function-call preparation */ |
314 | /* push function */ | 314 | /* push function */ |
315 | lua_pushvalue(L, 1); | 315 | lua_pushvalue(L, 1); |
316 | luaL_checkstack(L, n, "too many arguments"); | 316 | luaL_checkstack(L, n, l_s("too many arguments")); |
317 | for (i=0; i<n; i++) /* push arg[1...n] */ | 317 | for (i=0; i<n; i++) /* push arg[1...n] */ |
318 | lua_rawgeti(L, 2, i+1); | 318 | lua_rawgeti(L, 2, i+1); |
319 | status = lua_call(L, n, LUA_MULTRET); | 319 | status = lua_call(L, n, LUA_MULTRET); |
320 | if (err != 0) { /* restore old error method */ | 320 | if (err != 0) { /* restore old error method */ |
321 | lua_pushvalue(L, err); | 321 | lua_pushvalue(L, err); |
322 | lua_setglobal(L, LUA_ERRORMESSAGE); | 322 | lua_setglobal(L, l_s(LUA_ERRORMESSAGE)); |
323 | } | 323 | } |
324 | if (status != 0) { /* error in call? */ | 324 | if (status != 0) { /* error in call? */ |
325 | if (strchr(options, 'x')) | 325 | if (strchr(options, l_c('x'))) |
326 | lua_pushnil(L); /* return nil to signal the error */ | 326 | lua_pushnil(L); /* return nil to signal the error */ |
327 | else | 327 | else |
328 | lua_error(L, NULL); /* propagate error without additional messages */ | 328 | lua_error(L, NULL); /* propagate error without additional messages */ |
329 | return 1; | 329 | return 1; |
330 | } | 330 | } |
331 | if (strchr(options, 'p')) /* pack results? */ | 331 | if (strchr(options, l_c('p'))) /* pack results? */ |
332 | lua_error(L, "deprecated option `p' in `call'"); | 332 | lua_error(L, l_s("deprecated option `p' in `call'")); |
333 | return lua_gettop(L) - oldtop; /* results are already on the stack */ | 333 | return lua_gettop(L) - oldtop; /* results are already on the stack */ |
334 | } | 334 | } |
335 | 335 | ||
336 | 336 | ||
337 | static int luaB_tostring (lua_State *L) { | 337 | static int luaB_tostring (lua_State *L) { |
338 | char buff[64]; | 338 | l_char buff[64]; |
339 | switch (lua_type(L, 1)) { | 339 | switch (lua_type(L, 1)) { |
340 | case LUA_TNUMBER: | 340 | case LUA_TNUMBER: |
341 | lua_pushstring(L, lua_tostring(L, 1)); | 341 | lua_pushstring(L, lua_tostring(L, 1)); |
@@ -344,24 +344,24 @@ static int luaB_tostring (lua_State *L) { | |||
344 | lua_pushvalue(L, 1); | 344 | lua_pushvalue(L, 1); |
345 | return 1; | 345 | return 1; |
346 | case LUA_TTABLE: | 346 | case LUA_TTABLE: |
347 | sprintf(buff, "%.40s: %p", lua_xtype(L, 1), lua_topointer(L, 1)); | 347 | sprintf(buff, l_s("%.40s: %p"), lua_xtype(L, 1), lua_topointer(L, 1)); |
348 | break; | 348 | break; |
349 | case LUA_TFUNCTION: | 349 | case LUA_TFUNCTION: |
350 | sprintf(buff, "function: %p", lua_topointer(L, 1)); | 350 | sprintf(buff, l_s("function: %p"), lua_topointer(L, 1)); |
351 | break; | 351 | break; |
352 | case LUA_TUSERDATA: { | 352 | case LUA_TUSERDATA: { |
353 | const char *t = lua_xtype(L, 1); | 353 | const l_char *t = lua_xtype(L, 1); |
354 | if (strcmp(t, "userdata") == 0) | 354 | if (strcmp(t, l_s("userdata")) == 0) |
355 | sprintf(buff, "userdata(%d): %p", lua_tag(L, 1), lua_touserdata(L, 1)); | 355 | sprintf(buff, l_s("userdata(%d): %p"), lua_tag(L, 1), lua_touserdata(L, 1)); |
356 | else | 356 | else |
357 | sprintf(buff, "%.40s: %p", t, lua_touserdata(L, 1)); | 357 | sprintf(buff, l_s("%.40s: %p"), t, lua_touserdata(L, 1)); |
358 | break; | 358 | break; |
359 | } | 359 | } |
360 | case LUA_TNIL: | 360 | case LUA_TNIL: |
361 | lua_pushliteral(L, "nil"); | 361 | lua_pushliteral(L, l_s("nil")); |
362 | return 1; | 362 | return 1; |
363 | default: | 363 | default: |
364 | luaL_argerror(L, 1, "value expected"); | 364 | luaL_argerror(L, 1, l_s("value expected")); |
365 | } | 365 | } |
366 | lua_pushstring(L, buff); | 366 | lua_pushstring(L, buff); |
367 | return 1; | 367 | return 1; |
@@ -407,7 +407,7 @@ static int luaB_foreach (lua_State *L) { | |||
407 | static int luaB_assert (lua_State *L) { | 407 | static int luaB_assert (lua_State *L) { |
408 | luaL_checkany(L, 1); | 408 | luaL_checkany(L, 1); |
409 | if (lua_isnil(L, 1)) | 409 | if (lua_isnil(L, 1)) |
410 | luaL_verror(L, "assertion failed! %.90s", luaL_opt_string(L, 2, "")); | 410 | luaL_verror(L, l_s("assertion failed! %.90s"), luaL_opt_string(L, 2, l_s(""))); |
411 | lua_settop(L, 1); | 411 | lua_settop(L, 1); |
412 | return 1; | 412 | return 1; |
413 | } | 413 | } |
@@ -429,7 +429,7 @@ static int luaB_tinsert (lua_State *L) { | |||
429 | pos = n+1; | 429 | pos = n+1; |
430 | else | 430 | else |
431 | pos = luaL_check_int(L, 2); /* 2nd argument is the position */ | 431 | pos = luaL_check_int(L, 2); /* 2nd argument is the position */ |
432 | lua_pushliteral(L, "n"); | 432 | lua_pushliteral(L, l_s("n")); |
433 | lua_pushnumber(L, n+1); | 433 | lua_pushnumber(L, n+1); |
434 | lua_rawset(L, 1); /* t.n = n+1 */ | 434 | lua_rawset(L, 1); /* t.n = n+1 */ |
435 | for (; n>=pos; n--) { | 435 | for (; n>=pos; n--) { |
@@ -453,7 +453,7 @@ static int luaB_tremove (lua_State *L) { | |||
453 | lua_rawgeti(L, 1, pos+1); | 453 | lua_rawgeti(L, 1, pos+1); |
454 | lua_rawseti(L, 1, pos); /* a[pos] = a[pos+1] */ | 454 | lua_rawseti(L, 1, pos); /* a[pos] = a[pos+1] */ |
455 | } | 455 | } |
456 | lua_pushliteral(L, "n"); | 456 | lua_pushliteral(L, l_s("n")); |
457 | lua_pushnumber(L, n-1); | 457 | lua_pushnumber(L, n-1); |
458 | lua_rawset(L, 1); /* t.n = n-1 */ | 458 | lua_rawset(L, 1); /* t.n = n-1 */ |
459 | lua_pushnil(L); | 459 | lua_pushnil(L); |
@@ -527,12 +527,12 @@ static void auxsort (lua_State *L, int l, int u) { | |||
527 | for (;;) { /* invariant: a[l..i] <= P <= a[j..u] */ | 527 | for (;;) { /* invariant: a[l..i] <= P <= a[j..u] */ |
528 | /* repeat ++i until a[i] >= P */ | 528 | /* repeat ++i until a[i] >= P */ |
529 | while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) { | 529 | while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) { |
530 | if (i>u) lua_error(L, "invalid order function for sorting"); | 530 | if (i>u) lua_error(L, l_s("invalid order function for sorting")); |
531 | lua_pop(L, 1); /* remove a[i] */ | 531 | lua_pop(L, 1); /* remove a[i] */ |
532 | } | 532 | } |
533 | /* repeat --j until a[j] <= P */ | 533 | /* repeat --j until a[j] <= P */ |
534 | while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) { | 534 | while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) { |
535 | if (j<l) lua_error(L, "invalid order function for sorting"); | 535 | if (j<l) lua_error(L, l_s("invalid order function for sorting")); |
536 | lua_pop(L, 1); /* remove a[j] */ | 536 | lua_pop(L, 1); /* remove a[j] */ |
537 | } | 537 | } |
538 | if (j<i) { | 538 | if (j<i) { |
@@ -581,10 +581,10 @@ static int luaB_sort (lua_State *L) { | |||
581 | #define num_deprecated 4 | 581 | #define num_deprecated 4 |
582 | 582 | ||
583 | static const luaL_reg deprecated_names [num_deprecated] = { | 583 | static const luaL_reg deprecated_names [num_deprecated] = { |
584 | {"foreachvar", luaB_foreach}, | 584 | {l_s("foreachvar"), luaB_foreach}, |
585 | {"nextvar", luaB_next}, | 585 | {l_s("nextvar"), luaB_next}, |
586 | {"rawgetglobal", luaB_rawget}, | 586 | {l_s("rawgetglobal"), luaB_rawget}, |
587 | {"rawsetglobal", luaB_rawset} | 587 | {l_s("rawsetglobal"), luaB_rawset} |
588 | }; | 588 | }; |
589 | 589 | ||
590 | 590 | ||
@@ -618,7 +618,7 @@ static void deprecated_funcs (lua_State *L) { | |||
618 | ** gives an explicit error in any attempt to call a deprecated function | 618 | ** gives an explicit error in any attempt to call a deprecated function |
619 | */ | 619 | */ |
620 | static int deprecated_func (lua_State *L) { | 620 | static int deprecated_func (lua_State *L) { |
621 | luaL_verror(L, "function `%.20s' is deprecated", lua_tostring(L, -1)); | 621 | luaL_verror(L, l_s("function `%.20s' is deprecated"), lua_tostring(L, -1)); |
622 | return 0; /* to avoid warnings */ | 622 | return 0; /* to avoid warnings */ |
623 | } | 623 | } |
624 | 624 | ||
@@ -637,49 +637,49 @@ static void deprecated_funcs (lua_State *L) { | |||
637 | /* }====================================================== */ | 637 | /* }====================================================== */ |
638 | 638 | ||
639 | static const luaL_reg base_funcs[] = { | 639 | static const luaL_reg base_funcs[] = { |
640 | {LUA_ALERT, luaB__ALERT}, | 640 | {l_s(LUA_ALERT), luaB__ALERT}, |
641 | {LUA_ERRORMESSAGE, luaB__ERRORMESSAGE}, | 641 | {l_s(LUA_ERRORMESSAGE), luaB__ERRORMESSAGE}, |
642 | {"call", luaB_call}, | 642 | {l_s("call"), luaB_call}, |
643 | {"collectgarbage", luaB_collectgarbage}, | 643 | {l_s("collectgarbage"), luaB_collectgarbage}, |
644 | {"copytagmethods", luaB_copytagmethods}, | 644 | {l_s("copytagmethods"), luaB_copytagmethods}, |
645 | {"dofile", luaB_dofile}, | 645 | {l_s("dofile"), luaB_dofile}, |
646 | {"dostring", luaB_dostring}, | 646 | {l_s("dostring"), luaB_dostring}, |
647 | {"error", luaB_error}, | 647 | {l_s("error"), luaB_error}, |
648 | {"foreach", luaB_foreach}, | 648 | {l_s("foreach"), luaB_foreach}, |
649 | {"foreachi", luaB_foreachi}, | 649 | {l_s("foreachi"), luaB_foreachi}, |
650 | {"gcinfo", luaB_gcinfo}, | 650 | {l_s("gcinfo"), luaB_gcinfo}, |
651 | {"getglobal", luaB_getglobal}, | 651 | {l_s("getglobal"), luaB_getglobal}, |
652 | {"gettagmethod", luaB_gettagmethod}, | 652 | {l_s("gettagmethod"), luaB_gettagmethod}, |
653 | {"globals", luaB_globals}, | 653 | {l_s("globals"), luaB_globals}, |
654 | {"newtype", luaB_newtype}, | 654 | {l_s("newtype"), luaB_newtype}, |
655 | {"newtag", luaB_newtype}, /* for compatibility 4.0 */ | 655 | {l_s("newtag"), luaB_newtype}, /* for compatibility 4.0 */ |
656 | {"next", luaB_next}, | 656 | {l_s("next"), luaB_next}, |
657 | {"print", luaB_print}, | 657 | {l_s("print"), luaB_print}, |
658 | {"rawget", luaB_rawget}, | 658 | {l_s("rawget"), luaB_rawget}, |
659 | {"rawset", luaB_rawset}, | 659 | {l_s("rawset"), luaB_rawset}, |
660 | {"rawgettable", luaB_rawget}, /* for compatibility 3.2 */ | 660 | {l_s("rawgettable"), luaB_rawget}, /* for compatibility 3.2 */ |
661 | {"rawsettable", luaB_rawset}, /* for compatibility 3.2 */ | 661 | {l_s("rawsettable"), luaB_rawset}, /* for compatibility 3.2 */ |
662 | {"setglobal", luaB_setglobal}, | 662 | {l_s("setglobal"), luaB_setglobal}, |
663 | {"settag", luaB_settag}, | 663 | {l_s("settag"), luaB_settag}, |
664 | {"settagmethod", luaB_settagmethod}, | 664 | {l_s("settagmethod"), luaB_settagmethod}, |
665 | {"tag", luaB_tag}, | 665 | {l_s("tag"), luaB_tag}, |
666 | {"tonumber", luaB_tonumber}, | 666 | {l_s("tonumber"), luaB_tonumber}, |
667 | {"tostring", luaB_tostring}, | 667 | {l_s("tostring"), luaB_tostring}, |
668 | {"type", luaB_type}, | 668 | {l_s("type"), luaB_type}, |
669 | {"assert", luaB_assert}, | 669 | {l_s("assert"), luaB_assert}, |
670 | {"getn", luaB_getn}, | 670 | {l_s("getn"), luaB_getn}, |
671 | {"sort", luaB_sort}, | 671 | {l_s("sort"), luaB_sort}, |
672 | {"tinsert", luaB_tinsert}, | 672 | {l_s("tinsert"), luaB_tinsert}, |
673 | {"tremove", luaB_tremove}, | 673 | {l_s("tremove"), luaB_tremove}, |
674 | {"xtype", luaB_xtype}, | 674 | {l_s("xtype"), luaB_xtype}, |
675 | }; | 675 | }; |
676 | 676 | ||
677 | 677 | ||
678 | 678 | ||
679 | LUALIB_API void lua_baselibopen (lua_State *L) { | 679 | LUALIB_API void lua_baselibopen (lua_State *L) { |
680 | luaL_openl(L, base_funcs); | 680 | luaL_openl(L, base_funcs); |
681 | lua_pushliteral(L, LUA_VERSION); | 681 | lua_pushliteral(L, l_s(LUA_VERSION)); |
682 | lua_setglobal(L, "_VERSION"); | 682 | lua_setglobal(L, l_s("_VERSION")); |
683 | deprecated_funcs(L); | 683 | deprecated_funcs(L); |
684 | } | 684 | } |
685 | 685 | ||