Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- iff --git a/examples/dreamcast/lua/basic/Makefile b/examples/dreamcast/lua/basic/Makefile
- index a0698b3..941c444 100644
- --- a/examples/dreamcast/lua/basic/Makefile
- +++ b/examples/dreamcast/lua/basic/Makefile
- @@ -21,7 +21,7 @@ rm-elf:
- lua.elf: $(OBJS)
- $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o lua.elf $(KOS_START) $(OBJS) $(DATAOBJS) \
- - $(OBJEXTRA) -llua -llualib -lconio $(KOS_LIBS) -lm
- + $(OBJEXTRA) -llua -lconio $(KOS_LIBS) -lm
- run: lua.elf
- $(KOS_LOADER) lua.elf
- diff --git a/examples/dreamcast/lua/basic/lua.c b/examples/dreamcast/lua/basic/lua.c
- index 6377bb2..ff7c046 100644
- --- a/examples/dreamcast/lua/basic/lua.c
- +++ b/examples/dreamcast/lua/basic/lua.c
- @@ -16,8 +16,10 @@
- /* #include "lua.h"
- #include "luadebug.h"
- -#include "lualib.h" */
- +#include "lualib.h"*/
- #include <lua/lua.h>
- +#include <lua/lualib.h>
- +#include <lua/lauxlib.h>
- static lua_State *L = NULL;
- @@ -34,14 +36,14 @@ static lua_Hook old_linehook = NULL;
- static lua_Hook old_callhook = NULL;
- static void userinit(void) {
- - lua_baselibopen(L);
- - lua_iolibopen(L);
- - lua_strlibopen(L);
- - lua_mathlibopen(L);
- - lua_dblibopen(L);
- + luaL_openlibs(L);
- /* add your libraries here */
- }
- +static int lua_dostring(lua_State *L, const char *str) {
- + return luaL_dostring(L, str);
- +}
- +
- static int ldo(int (*f)(lua_State *l, const char *), const char *name) {
- int res;
- int top = lua_gettop(L);
- @@ -126,24 +128,24 @@ static void manual_input(int version, int prompt) {
- assert(r >= 0);
- if(strlen(buffer)) {
- - ldo(lua_dostring, buffer);
- - lua_settop(L, 0); /* remove eventual results */
- - }
- - }
- + ldo(lua_dostring, buffer);
- + lua_settop(L, 0); /* remove eventual results */
- + }
- + }
- - conio_printf("\n");
- + conio_printf("\n");
- }
- #if 0
- static int handle_argv(char *argv[], struct Options *opt) {
- - if(opt->stacksize > 0) argv++; /* skip option `-s' (if present) */
- -
- - if(*argv == NULL) { /* no more arguments? */
- - if(isatty(0)) {
- - manual_input(1, 1);
- - }
- - else
- - ldo(lua_dofile, NULL); /* executes stdin as a file */
- + if(opt->stacksize > 0) argv++; /* skip option `-s' (if present) */
- +
- + if(*argv == NULL) { /* no more arguments? */
- + if(isatty(0)) {
- + manual_input(1, 1);
- + }
- + else
- + ldo(lua_dofile, NULL); /* executes stdin as a file */
- }
- else { /* other arguments; loop over them */
- int i;
- @@ -233,9 +235,9 @@ int main(int argc, char *argv[]) {
- pvr_init_defaults();
- conio_init(CONIO_TTY_SERIAL, CONIO_INPUT_LINE);
- - luaB_set_fputs((void (*)(const char *))conio_printf);
- + //luaB_set_fputs((void (*)(const char *))conio_printf);
- - L = lua_open(); /* create state */
- + L = luaL_newstate(); /* create state */
- if(L == NULL) {
- printf("Invalid state.. giving up\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement