···11/*
22-** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $
22+** $Id: loadlib.c,v 1.52.1.4 2009/09/09 13:17:16 roberto Exp $
33** Dynamic library loader for Lua
44** See Copyright Notice in lua.h
55**
···2121#include "lauxlib.h"
2222#include "lualib.h"
2323#include "rocklib.h"
2424-2424+#include "rocklibc.h"
25252626-#define setprogdir(L) ((void)0)
2626+#define setprogdir(L) ((void)0) /* ROCKLUA ADDED */
272728282929/*
···54545555static const char *findfile (lua_State *L, const char *name,
5656 const char *pname) {
5757- get_current_path(L, 2);
5757+ get_current_path(L, 2); /* ROCKLUA ADDED */
5858 const char *current_path = lua_tostring(L, -1);
5959 const char *path;
6060···196196 lua_setfield(L, -2, "_M"); /* module._M = module */
197197 lua_pushstring(L, modname);
198198 lua_setfield(L, -2, "_NAME");
199199- dot = rb->strrchr(modname, '.'); /* look for last dot in module name */
199199+ dot = strrchr(modname, '.'); /* look for last dot in module name */
200200 if (dot == NULL) dot = modname;
201201 else dot++;
202202 /* set _PACKAGE as package name (full module name minus last part) */
···292292 lua_pushvalue(L, -1);
293293 lua_replace(L, LUA_ENVIRONINDEX);
294294 /* create `loaders' table */
295295- lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1);
295295+ lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0);
296296 /* fill it with pre-defined loaders */
297297 for (i=0; loaders[i] != NULL; i++) {
298298 lua_pushcfunction(L, loaders[i]);
+5-5
apps/plugins/lua/lparser.c
···11/*
22-** $Id: lparser.c,v 2.42.1.3 2007/12/28 15:32:23 roberto Exp $
22+** $Id: lparser.c,v 2.42.1.4 2011/10/21 19:31:42 roberto Exp $
33** Lua Parser
44** See Copyright Notice in lua.h
55*/
···325325}
326326327327328328-static void lparser_open_func (LexState *ls, FuncState *fs) {
328328+static void open_func (LexState *ls, FuncState *fs) {
329329 lua_State *L = ls->L;
330330 Proto *f = luaF_newproto(L);
331331 fs->f = f;
···374374 lua_assert(luaG_checkcode(f));
375375 lua_assert(fs->bl == NULL);
376376 ls->fs = fs->prev;
377377- L->top -= 2; /* remove table and prototype from the stack */
378377 /* last token read was anchored in defunct function; must reanchor it */
379378 if (fs) anchor_token(ls);
379379+ L->top -= 2; /* remove table and prototype from the stack */
380380}
381381382382···385385 struct FuncState funcstate;
386386 lexstate.buff = buff;
387387 luaX_setinput(L, &lexstate, z, luaS_new(L, name));
388388- lparser_open_func(&lexstate, &funcstate);
388388+ open_func(&lexstate, &funcstate);
389389 funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */
390390 luaX_next(&lexstate); /* read first token */
391391 chunk(&lexstate);
···576576static void body (LexState *ls, expdesc *e, int needself, int line) {
577577 /* body -> `(' parlist `)' chunk END */
578578 FuncState new_fs;
579579- lparser_open_func(ls, &new_fs);
579579+ open_func(ls, &new_fs);
580580 new_fs.f->linedefined = line;
581581 checknext(ls, '(');
582582 if (needself) {
+6-2
apps/plugins/lua/lstrlib.c
···11/*
22-** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $
22+** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $
33** Standard library for string operations and pattern-matching
44** See Copyright Notice in lua.h
55*/
···754754755755756756static int str_format (lua_State *L) {
757757+ int top = lua_gettop(L);
757758 int arg = 1;
758759 size_t sfl;
759760 const char *strfrmt = luaL_checklstring(L, arg, &sfl);
···768769 else { /* format item */
769770 char form[MAX_FORMAT]; /* to store the format (`%...') */
770771 char buff[MAX_ITEM]; /* to store the formatted item */
771771- arg++;
772772+ if (++arg > top)
773773+ luaL_argerror(L, arg, "no value");
772774 strfrmt = scanformat(L, strfrmt, form);
773775 switch (*strfrmt++) {
774776 case 'c': {
···785787 snprintf(buff, MAX_ITEM, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
786788 break;
787789 }
790790+#if 0 /* ROCKLUA NO FLOATING POINT */
788791 case 'e': case 'E': case 'f':
789792 case 'g': case 'G': {
790793 snprintf(buff, MAX_ITEM, form, (double)luaL_checknumber(L, arg));
791794 break;
792795 }
796796+#endif
793797 case 'q': {
794798 addquoted(L, &b, arg);
795799 continue; /* skip the 'addsize' at the end */
+4-4
apps/plugins/lua/lua.h
···11/*
22-** $Id$
22+** $Id: lua.h,v 1.218.1.7 2012/01/13 20:36:20 roberto Exp $
33** Lua - An Extensible Extension Language
44** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
55** See Copyright Notice at the end of this file
···171718181919#define LUA_VERSION "Lua 5.1"
2020-#define LUA_RELEASE "Lua 5.1.4"
2020+#define LUA_RELEASE "Lua 5.1.5"
2121#define LUA_VERSION_NUM 501
2222-#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio"
2222+#define LUA_COPYRIGHT "Copyright (C) 1994-2012 Lua.org, PUC-Rio"
2323#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
24242525···362362363363364364/******************************************************************************
365365-* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved.
365365+* Copyright (C) 1994-2012 Lua.org, PUC-Rio. All rights reserved.
366366*
367367* Permission is hereby granted, free of charge, to any person obtaining
368368* a copy of this software and associated documentation files (the