diff --git a/game.lua b/game.lua index ce7d8a0..32876a9 100644 --- a/game.lua +++ b/game.lua @@ -2,4 +2,5 @@ a=32 hex=string.format("%02X",a) print(hex) b=tonumber(hex,16) -print(b) \ No newline at end of file +print(b) +debug("b = " .. b) diff --git a/lua.cpp b/lua.cpp index 2b40022..a86973a 100644 --- a/lua.cpp +++ b/lua.cpp @@ -86,6 +86,7 @@ void table_to_str(lua_State *L, int indx) { } extern "C" { + static int cpp_cls(lua_State *L) { uint8_t color = luaL_optinteger(L, 1, 32); cls(color); @@ -420,7 +421,26 @@ bool lua_is_playing() { return lua_state == STATE_PLAYING; } -const char boot[] = "function init()mode(1)cls()play('o5l0v5cegv4cegv3cegv2cegv1ceg')memcpy(360,4608,240)memcpy(1560,4848,240)ink(1)print('G A M E',8,16)ink(4)print('S Y S T E M',20,16)ink(7)print('mini',9,8)ink(8)print('v0.7.3',34,29)w=0 end function update()w=w+1 if w>90 then cls()load()end end"; +const char boot[] = + "function init()" + "mode(1)" + "cls()" + "play('o5l0v5cegv4cegv3cegv2cegv1ceg')" + "memcpy(360,4608,240)" + "memcpy(1560,4848,240)" + "ink(1) print('G A M E',8,16)" + "ink(4) print('S Y S T E M',20,16)" + "ink(7) print('mini',9,8)" + "ink(8) print('v0.7.4',34,29)" + "w=0 " + "end " + "function update()" + "w=w+1 " + "if w>90 then " + "cls()" + "load()" + "end" + "end"; void lua_init(const char* filename, const bool start_playing) { if (lua_state != STATE_STOPPED) lua_quit(); @@ -429,6 +449,9 @@ void lua_init(const char* filename, const bool start_playing) { //init_exists = update_exists = false; bool file_loaded = true; + lua_getglobal(L, "print"); + lua_setglobal(L, "debug"); + if (filename == NULL) { if (luaL_loadstring(L, boot)) { debug("BOOT ERROR:", false);