Last active
February 1, 2025 07:08
Revisions
-
josefnpat revised this gist
Feb 6, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * PICO-8's Lua has single line shorthand for if then else operators. → _Compare to ternary?: PICO-8 Lua: `IF (NOT B) THEN I=1 J=2 END` vs Lua: `i,j = not b and 1,j or i,2`._ * PICO-8's Lua has a different precision (16:16 fixed point) vs Lua's double-precision floating-point. * PICO-8's Lua has additional Comparison operators/relational operators for "Not Equal To" (`~=`): `!=` * There is no `io` object. → _There is technically "Cartridge Data" that you can use for persistant information - see `cartdata()`_ * `load()` has been overwritten with a PICO-8 function. * PICO-8 introduces many other global functions (see [manual](http://www.lexaloffle.com/pico-8.php?page=manual)). * There are general rounding errors: `print("-1"*1 == -1") -- false` -
josefnpat revised this gist
Jan 31, 2017 . 1 changed file with 15 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -39,24 +39,24 @@ print(munpack{1, 2, 3, 4}) *Thanks to bartbes for this much better version* ```lua function pow(x,a) if (a==0) return 1 if (a<0) x,a=1/x,-a local ret,a0,xn=1,flr(a),x a-=a0 while a0>=1 do if (a0%2>=1) ret*=xn xn,a0=xn*xn,shr(a0,1) end while a>0 do while a<1 do x,a=sqrt(x),a+a end ret,a=ret*x,a-1 end return ret end ``` *Thanks to samhocevar for this implementation ([link](http://www.lexaloffle.com/bbs/?pid=30791#p30791))* ## Lua's String Library -
josefnpat revised this gist
Jan 31, 2017 . 1 changed file with 20 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,6 +38,26 @@ print(munpack{1, 2, 3, 4}) ``` *Thanks to bartbes for this much better version* ```lua function pow(x,a) if (a==0) return 1 if (a<0) x,a=1/x,-a local ret,a0,xn=1,flr(a),x a-=a0 while a0>=1 do if (a0%2>=1) ret*=xn xn,a0=xn*xn,shr(a0,1) end while a>0 do while a<1 do x,a=sqrt(x),a+a end ret,a=ret*x,a-1 end return ret end ``` *Thanks to samhocevar for this implementation ([link](http://www.lexaloffle.com/bbs/?pid=30791#p30791)) ## Lua's String Library `0.1.3` -
josefnpat revised this gist
Jun 5, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * `load()` has been overwritten with a PICO-8 function. * PICO-8 introduces many other global functions (see [manual](http://www.lexaloffle.com/pico-8.php?page=manual)). * There are general rounding errors: `print("-1"*1 == -1") -- false` * Global functions and variables have been removed: `collectgarbage`, `dofile`, `error`, `ipairs`, `loadfile`, `loadstring`, `math`, `module`, `package`, `pcall`, `rawequal`, `rawlen`, `rawget`, `require`, `select`, `string`, `table`, `tonumber`, `tostring`, `unpack`, `xpcall`, `_VERSION`, and `getmetatable`. * `_G` global table has been removed. * `assert()` and `type()` were removed in `0.1.3` but added back in `0.1.4`. * `coroutine.[create|resume|status|yield]()` was removed in `0.1.3` but added in `0.1.6` as `coroutine()`, `cocreate()`, `coresume()`, `costatus()` and `yield()` respectively. -
josefnpat revised this gist
Jun 5, 2016 . 1 changed file with 0 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,13 +38,6 @@ print(munpack{1, 2, 3, 4}) ``` *Thanks to bartbes for this much better version* ## Lua's String Library `0.1.3` -
josefnpat revised this gist
Jun 5, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * Global functions and variables have been removed: `collectgarbage`, `dofile`, `error`, `ipairs`, `loadfile`, `loadstring`, `module`, `package`, `pcall`, `rawequal`, `rawlen`, `rawget`, `require`, `select`, `tonumber`, `tostring`, `unpack`, `xpcall`, `_VERSION`, and `getmetatable`. * `_G` global table has been removed. * `assert()` and `type()` were removed in `0.1.3` but added back in `0.1.4`. * `coroutine.[create|resume|status|yield]()` was removed in `0.1.3` but added in `0.1.6` as `coroutine()`, `cocreate()`, `coresume()`, `costatus()` and `yield()` respectively. * `setmetatable` was removed in `0.1.3` but added back in `0.1.6` ## Alternates to missing functions -
josefnpat revised this gist
Jun 5, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * PICO-8's Lua has a different precision (16:16 fixed point) vs Lua's double-precision floating-point. * PICO-8's Lua has additional Comparison operators/relational operators for "Not Equal To" (`~=`): `!=` * There is no `io` object. → _There is technically "Cartride Data" that you can use for persistant information - see `cartdata()`_ * `load()` has been overwritten with a PICO-8 function. * PICO-8 introduces many other global functions (see [manual](http://www.lexaloffle.com/pico-8.php?page=manual)). * There are general rounding errors: `print("-1"*1 == -1") -- false` * Global functions and variables have been removed: `collectgarbage`, `dofile`, `error`, `ipairs`, `loadfile`, `loadstring`, `module`, `package`, `pcall`, `rawequal`, `rawlen`, `rawget`, `require`, `select`, `tonumber`, `tostring`, `unpack`, `xpcall`, `_VERSION`, and `getmetatable`. -
josefnpat revised this gist
Jun 5, 2016 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,6 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua ## General * anything written in uppercase the PICO-8 editor or .p8 is made lowercase by the editor. → _editing the .p8 file directly can work_ * `print(function() end)` outputs the string `function` instead of the string `function: 0x0000000`. * `print` takes three arguments (string,x,y) → _use `printh()` instead_ * PICO-8's Lua supports a few [Compound assignment operators](https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Compound_assignment_operators): `+=`,`-=`,`*=`,`/=`,`%=` -
josefnpat revised this gist
Jun 5, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ This information applies to the PICO-8 `0.1.6` release. This document is here to help folks with a proficiency in Lua understand the limitations and discrepencies between Lua and PICO-8's Lua. You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manual) or [yellowafterlife's extended `0.1.1` manual](https://dl.dropboxusercontent.com/u/3594143/yal.cc/r/picodoc/index.html). ## General -
josefnpat revised this gist
Jun 5, 2016 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,11 +18,11 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * `load` has been overwritten with a PICO-8 function. * PICO-8 introduces many other global functions (see [manual](http://www.lexaloffle.com/pico-8.php?page=manual)). * There are general rounding errors: `print("-1"*1 == -1") -- false` * Global functions and variables have been removed: `collectgarbage`, `dofile`, `error`, `ipairs`, `loadfile`, `loadstring`, `module`, `package`, `pcall`, `rawequal`, `rawlen`, `rawget`, `require`, `select`, `tonumber`, `tostring`, `unpack`, `xpcall`, `_VERSION`, and `getmetatable`. * `_G` global table has been removed. * `assert()` and `type()` were removed in `0.1.3` but added back in `0.1.4`. * `coroutine.[create|resume|status|yield]()` was removed in `0.1.3` but added in `0.1.6` as `coroutine()`, `cocreate()`, `coresume()`, `costatus()` and `yield()`. * `setmetatable` was removed in `0.1.3` but added back in `0.1.6` ## Alternates to missing functions -
josefnpat revised this gist
Jun 5, 2016 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,12 +14,15 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * PICO-8's Lua has single line shorthand for if then else operators. → _Compare to ternary?: PICO-8 Lua: `IF (NOT B) THEN I=1 J=2 END` vs Lua: `i,j = not b and 1,j or i,2`._ * PICO-8's Lua has a different precision (16:16 fixed point) vs Lua's double-precision floating-point. * PICO-8's Lua has additional Comparison operators/relational operators for "Not Equal To" (`~=`): `!=` * There is no `io` object. → _There is technically "Cartride Data" that you can use for persistant information - see `cartdata()`_ * `load` has been overwritten with a PICO-8 function. * PICO-8 introduces many other global functions (see [manual](http://www.lexaloffle.com/pico-8.php?page=manual)). * There are general rounding errors: `print("-1"*1 == -1") -- false` * Global functions and variables have been removed: `assert`, `collectgarbage`, `dofile`, `error`, `ipairs`, `loadfile`, `loadstring`, `module`, `package`, `pcall`, `rawequal`, `rawlen`, `rawget`, `require`, `select`, `tonumber`, `tostring`, `type`, `unpack`, `xpcall`, `_VERSION`, and `getmetatable`. * `_G` global table has been removed. * `setmetatable` was removed in `0.1.3` but added back in `0.1.6` * `coroutine.[create|resume|status|yield]()` was removed in `0.1.3` but added in `0.1.6` as `coroutine()`, `cocreate()`, `coresume()`, `costatus()` and `yield()`. * `assert()` and `type()` were removed in `0.1.3` but added back in `0.1.4`. ## Alternates to missing functions -
josefnpat revised this gist
Jun 5, 2016 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,14 @@ This information applies to the PICO-8 `0.1.6` release. This document is here to help folks with a proficiency in Lua understand the limitations and discrepencies between Lua and PICO-8's Lua. You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manual) or [yellowafterlife's extended 0.1.1 manual](https://dl.dropboxusercontent.com/u/3594143/yal.cc/r/picodoc/index.html). ## General * anything written in uppercase the PICO-8 editor or .p8 is made lowercase by the editor. → _editing the .p8 file directly can work_ * `print(function() end)` outputs the string `function` instead of the string `function: 0x0000000`. * `print` takes three arguments (string,x,y) → _use `printh()` instead_ * PICO-8's Lua supports a few [Compound assignment operators](https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Compound_assignment_operators): `+=`,`-=`,`*=`,`/=`,`%=` * PICO-8's Lua has single line shorthand for if then else operators. → _Compare to ternary?: PICO-8 Lua: `IF (NOT B) THEN I=1 J=2 END` vs Lua: `i,j = not b and 1,j or i,2`._ -
josefnpat revised this gist
Jun 5, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ This information applies to the PICO-8 `0.1.3` release. This document is here to help folks with a proficiency in Lua understand the limitations and discrepencies between Lua and PICO-8's Lua. -
josefnpat revised this gist
Nov 17, 2015 . 1 changed file with 8 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,27 +25,16 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua ### unpack ```lua function munpack(t, from, to) from = from or 1 to = to or #t if from > to then return end return t[from], munpack(t, from+1, to) end print(munpack{1, 2, 3, 4}) ``` *Thanks to bartbes for this much better version* `0.1.2` -
josefnpat revised this gist
Oct 25, 2015 . 1 changed file with 26 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,6 +21,32 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * Global functions and variables have been removed: `assert`, `collectgarbage`, `coroutine`, `dofile`, `error`, `ipairs`, `loadfile`, `loadstring`, `module`, `package`, `pcall`, `rawequal`, `rawlen`, `rawget`, `require`, `select`, `tonumber`, `tostring`, `type`, `unpack`, `xpcall`, `_VERSION`, and `[s|g]etmetatable`. * `_G` global table has been removed. ## Alternates to missing functions ### unpack ```lua function unpack(arg) local argcount = #arg if argcount == 0 then return elseif argcount == 1 then return arg[1] elseif argcount == 2 then return arg[1],arg[2] elseif argcount == 3 then return arg[1],arg[2],arg[3] elseif argcount == 4 then return arg[1],arg[2],arg[3],arg[4] elseif argcount == 5 then return arg[1],arg[2],arg[3],arg[4],arg[5] elseif argcount == 6 then return arg[1],arg[2],arg[3],arg[4],arg[5],arg[6] else print("warning: please extend unpack2 to provide larger unpack") end end ``` `0.1.2` * `ipairs` does not have the proper indexing and will loop over the first element infinitely . → _use `pairs` instead_ -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * `load` has been overwritten with a PICO-8 function. * PICO-8 introduces many other global functions (see [manual](http://www.lexaloffle.com/pico-8.php?page=manual)). * There are general rounding errors: `print("-1"*1 == -1") -- false` * Global functions and variables have been removed: `assert`, `collectgarbage`, `coroutine`, `dofile`, `error`, `ipairs`, `loadfile`, `loadstring`, `module`, `package`, `pcall`, `rawequal`, `rawlen`, `rawget`, `require`, `select`, `tonumber`, `tostring`, `type`, `unpack`, `xpcall`, `_VERSION`, and `[s|g]etmetatable`. * `_G` global table has been removed. `0.1.2` -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 9 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * `load` has been overwritten with a PICO-8 function. * PICO-8 introduces many other global functions (see [manual](http://www.lexaloffle.com/pico-8.php?page=manual)). * There are general rounding errors: `print("-1"*1 == -1") -- false` * `assert`, `dofile`, `tostring`, `type`, `ipairs`, `_VERSION`, `rawlen` and `[s|g]etmetatable` have been removed. * `_G` global table has been removed. `0.1.2` @@ -123,7 +123,14 @@ __This function has not been compared, but seems intact.__ * `all` function. Not sure what it does. * `_set_mainloop_exists` function. Most likely toggles a variable in a local scope. * `stop` function. Stops game at current point so you can debug things. `0.1.2` ## bit32 library `0.1.3` The `bit32` table is no longer available. `0.1.2` -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * `load` has been overwritten with a PICO-8 function. * PICO-8 introduces many other global functions (see [manual](http://www.lexaloffle.com/pico-8.php?page=manual)). * There are general rounding errors: `print("-1"*1 == -1") -- false` * `tostring`, `type`, `ipairs`, `_VERSION`, `rawlen` and `[s|g]etmetatable` have been removed. * `_G` global table has been removed. `0.1.2` -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 45 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,17 +14,28 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * PICO-8's Lua has single line shorthand for if then else operators. → _Compare to ternary?: PICO-8 Lua: `IF (NOT B) THEN I=1 J=2 END` vs Lua: `i,j = not b and 1,j or i,2`._ * PICO-8's Lua has a different precision (16:16 fixed point) vs Lua's double-precision floating-point. * PICO-8's Lua has additional Comparison operators/relational operators for "Not Equal To" (`~=`): `!=` * There is no `io` object. → _There is technically "Cartride Data" that you can use for persistant information_ * `load` has been overwritten with a PICO-8 function. * PICO-8 introduces many other global functions (see [manual](http://www.lexaloffle.com/pico-8.php?page=manual)). * There are general rounding errors: `print("-1"*1 == -1") -- false` * `ipairs`,`_VERSION`,`rawlen` and `[s|g]etmetatable` have been removed. * `_G` global table has been removed. `0.1.2` * `ipairs` does not have the proper indexing and will loop over the first element infinitely . → _use `pairs` instead_ * `_VERSION` exists, but can't be accessed via the editor. → _It returns `Lua 5.2`._ * `rawlen` returns small fractions [incorrect value] * `[s|g]etmetatable` needs to be tested. ## Lua's String Library `0.1.3` The `string` table is no longer available. `0.1.2` * strings that use upper case pattern matching will not be able to be entered into the editor directly. * `string.byte` returns a fraction [incorrect value] * `string.char` operates differently: @@ -41,12 +52,24 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua ## Lua's Table Library `0.1.3` The `table` table is no longer available. `0.1.2` * `table.insert(t,o)` does not insert the proper key. → _use `add(t,o)` instead_ * `table.insert(t,p,o)` does not insert the proper key. Attempting to insert beyond table initialization causes an position out of bounds error. * `table.remove(t,p)` removes the correct value, but then assocates every following value with the key before it. → _use `del(t,o)` instead_ ## Lua's Math Library `0.1.3` The `math` table is no longer available. `0.1.2` * `math.a[cos|sin|tan][2]` does not work correctly. [Rounding errors?] → _use `atan2()` instead of `math.atan2()`. Untested versions [here](http://pastebin.com/RsjHmCV8)_ * `math.[floor|ceil]` returns input [incorrect value] → _use `flr()` instead. For `math.ceil()`, use `function ceil(x) return -flr(-x) end`_ * `math.[cos|sin]` return zero [incorrect value] → _use `cos()` and `sin()`. Functions take 0..1 instead of 0..PI*2, and `sin()` is inverted._ @@ -66,6 +89,12 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua ## Lua's OS library `0.1.3` The `os` table is no longer available. `0.1.2` * `os.date` works correctly, but due to a lack of upper case characters, it does not render correctly. * `os.time` returns the incorrect value [rounding issues] * `os.getenv` works correctly, but the editor cannot write upper case characters. @@ -75,18 +104,27 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua ## Debug Library `0.1.3` The `debug` table is no longer available. `0.1.2` __This function has not been compared, but seems intact.__ ## Undocumented PICO-8 functions * `shutdown` quits the `pico8` binary. * `_update_buttons` function. Has no arguments. * `_p8_program` function. Causes out of memory error when called. * `decompress` function. Not sure what it does. * `c` variable may sometime be globally set. Seems to be a scope error for some other function. * `trace` function. I'm guessing it's for the runtime errors. * `all` function. Not sure what it does. * `_set_mainloop_exists` function. Most likely toggles a variable in a local scope. * `stop` function. Stops game at current point so you can debug things. * The `bit32` table is no longer available. `0.1.2` * `bit32` table contains: `extract`,`bnot`,`rrotate`,`arshift`,`btest`,`bxor`,`replace`,`band`,`lshift`,`rshift`,`lrotate`,`bor` -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua ## General * anything written in uppercase the PICO-8 editor or .p8 is made lowercase by the editor. → _editing the .p8 file directly can work_ * multi line comments don't work correctly. → _use single lines to get around this_ * `print(function() end)` segfaults → _wrapping it in a `tostring()` will fix it_ * `print` takes three arguments (string,x,y) → _use `printh()` instead_ -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -52,7 +52,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * `math.[cos|sin]` return zero [incorrect value] → _use `cos()` and `sin()`. Functions take 0..1 instead of 0..PI*2, and `sin()` is inverted._ * `math.tan` does not work correctly. [Rounding errors?] → _use math instead: _ * `math.[cos|sin|tan]h` does not work correctly. [Rounding errors?] * `math.[deg|rad]` return zero [incorrect value] → _use math instead: _ * `math.[exp|log]` does not work correctly [Rounding errors?] * `math.log10` is nil [does not exist] * `math.pow` does not work correctly [returns -maxint] → _use the `^` operator instead_ -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -52,17 +52,17 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * `math.[cos|sin]` return zero [incorrect value] → _use `cos()` and `sin()`. Functions take 0..1 instead of 0..PI*2, and `sin()` is inverted._ * `math.tan` does not work correctly. [Rounding errors?] → _use math instead: _ * `math.[cos|sin|tan]h` does not work correctly. [Rounding errors?] * `math.[deg|rad]` return zero [incorrect value] → _use math instead:  * `math.[exp|log]` does not work correctly [Rounding errors?] * `math.log10` is nil [does not exist] * `math.pow` does not work correctly [returns -maxint] → _use the `^` operator instead_ * `math.modf` returns two zeros [incorrect value] → _use the `%` operator instead_ * `math.sqrt` does not work correctly [Rounding errors?] → _use `sqrt()` instead_ * `math.random` does not work correctly [returns zero] → _use `rnd()` instead_ * `math.randomseed` cannot be verified until math.random is fixed [dependency issue] → _use `srand()` instead_ * `math.frexp` does not return a value [incorrect return type] → _but `math.ldexp()` works for some reason!_ * `math.huge` is 0.5 [incorrect value and type] * `math.pi` is 5.341e-05 [incorrect value] → _use a fixed value instead, e.g.: 3.14159_ ## Lua's OS library -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,7 +50,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * `math.a[cos|sin|tan][2]` does not work correctly. [Rounding errors?] → _use `atan2()` instead of `math.atan2()`. Untested versions [here](http://pastebin.com/RsjHmCV8)_ * `math.[floor|ceil]` returns input [incorrect value] → _use `flr()` instead. For `math.ceil()`, use `function ceil(x) return -flr(-x) end`_ * `math.[cos|sin]` return zero [incorrect value] → _use `cos()` and `sin()`. Functions take 0..1 instead of 0..PI*2, and `sin()` is inverted._ * `math.tan` does not work correctly. [Rounding errors?] → _use math instead: _ * `math.[cos|sin|tan]h` does not work correctly. [Rounding errors?] * `math.[deg|rad]` return zero [incorrect value] * `math.[exp|log]` does not work correctly [Rounding errors?] -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,7 +48,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua ## Lua's Math Library * `math.a[cos|sin|tan][2]` does not work correctly. [Rounding errors?] → _use `atan2()` instead of `math.atan2()`. Untested versions [here](http://pastebin.com/RsjHmCV8)_ * `math.[floor|ceil]` returns input [incorrect value] → _use `flr()` instead. For `math.ceil()`, use `function ceil(x) return -flr(-x) end`_ * `math.[cos|sin]` return zero [incorrect value] → _use `cos()` and `sin()`. Functions take 0..1 instead of 0..PI*2, and `sin()` is inverted._ * `math.tan` does not work correctly. [Rounding errors?] * `math.[cos|sin|tan]h` does not work correctly. [Rounding errors?] -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,7 +48,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua ## Lua's Math Library * `math.a[cos|sin|tan][2]` does not work correctly. [Rounding errors?] → _use `atan2()` instead of `math.atan2()`. Untested versions [here](http://pastebin.com/RsjHmCV8)_ * `math.[floor|ceil]` returns input [incorrect value] → _use `flr()` instead. For ceil, use `function ceil(x) return -flr(-x) end`_ * `math.[cos|sin]` return zero [incorrect value] → _use `cos()` and `sin()`. Functions take 0..1 instead of 0..PI*2, and `sin()` is inverted._ * `math.tan` does not work correctly. [Rounding errors?] * `math.[cos|sin|tan]h` does not work correctly. [Rounding errors?] -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -47,7 +47,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua ## Lua's Math Library * `math.a[cos|sin|tan][2]` does not work correctly. [Rounding errors?] → _use `atan2()` instead of `math.atan2()`. Untested versions [here](http://pastebin.com/RsjHmCV8)_ * `math.[floor|ceil]` returns input [incorrect value] → _use `flr()` instead_ * `math.[cos|sin]` return zero [incorrect value] → _use `cos()` and `sin()`. Functions take 0..1 instead of 0..PI*2, and `sin()` is inverted._ * `math.tan` does not work correctly. [Rounding errors?] -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,8 +8,8 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * anything written in uppercase the PICO-8 editor or .p8 is made lowercase by the editor. → _editing the .p8 file directly can work__ * multi line comments don't work correctly. → _use single lines to get around this_ * `print(function() end)` segfaults → _wrapping it in a `tostring()` will fix it_ * `print` takes three arguments (string,x,y) → _use `printh()` instead_ * PICO-8's Lua supports a few [Compound assignment operators](https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Compound_assignment_operators): `+=`,`-=`,`*=`,`/=`,`%=` * PICO-8's Lua has single line shorthand for if then else operators. → _Compare to ternary?: PICO-8 Lua: `IF (NOT B) THEN I=1 J=2 END` vs Lua: `i,j = not b and 1,j or i,2`._ * PICO-8's Lua has a different precision (16:16 fixed point) vs Lua's double-precision floating-point. -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 9 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * anything written in uppercase the PICO-8 editor or .p8 is made lowercase by the editor. → _editing the .p8 file directly can work__ * multi line comments don't work correctly. → _use single lines to get around this_ * `print(function() end)` segfaults → _(wrapping it in a `tostring()` will fix it)_ * `print` takes three arguments (string,x,y) * PICO-8's Lua supports a few [Compound assignment operators](https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Compound_assignment_operators): `+=`,`-=`,`*=`,`/=`,`%=` * PICO-8's Lua has single line shorthand for if then else operators. → _Compare to ternary?: PICO-8 Lua: `IF (NOT B) THEN I=1 J=2 END` vs Lua: `i,j = not b and 1,j or i,2`._ @@ -47,8 +47,8 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua ## Lua's Math Library * `math.a[cos|sin|tan][2]` does not work correctly. [Rounding errors?] → _use `atan2()` instead of `math.atan2()`_ * `math.[floor|ceil]` returns input [incorrect value] → _use `flr()` instead_ * `math.[cos|sin]` return zero [incorrect value] → _use `cos()` and `sin()`. Functions take 0..1 instead of 0..PI*2, and `sin()` is inverted._ * `math.tan` does not work correctly. [Rounding errors?] * `math.[cos|sin|tan]h` does not work correctly. [Rounding errors?] @@ -57,10 +57,10 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * `math.log10` is nil [does not exist] * `math.pow` does not work correctly [returns -maxint] → _use the `^` operator instead_ * `math.modf` returns two zeros [incorrect value] → _use the `%` operator instead_ * `math.sqrt` does not work correctly [Rounding errors?] → _use `sqrt()` instead_ * `math.random` does not work correctly [returns zero] → _use `rnd()` instead_ * `math.randomseed` cannot be verified until math.random is fixed [dependency issue] → _use `srand()` instead_ * `math.frexp` does not return a value [incorrect return type] _but `math.ldexp()` works for some reason!_ * `math.huge` is 0.5 [incorrect value and type] * `math.pi` is 5.341e-05 [incorrect value] @@ -69,9 +69,9 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * `os.date` works correctly, but due to a lack of upper case characters, it does not render correctly. * `os.time` returns the incorrect value [rounding issues] * `os.getenv` works correctly, but the editor cannot write upper case characters. * `os.difftime` does not work correctly, but I think that this could be used to get `os.time()` to work correctly. * `os.re[name|move]` this probably works, but operates where the binary for `pico8` is located. * `os.clock` doesn't work correctly, but could probably be scaled to the correct value. → _pico8 is forced at 30fps; calculate time by incrementing a variable in `_update()` by 1/30._ ## Debug Library -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -71,7 +71,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * `os.getenv` works correctly, but the editor cannot write upper case characters. * `os.difftime` does not work correctly, but I think that this could be used to get `os.time` to work correctly. * `os.re[name|move]` this probably works, but operates where the binary for `pico8` is located. * `os.clock` doesn't work correctly, but could probably be scaled to the correct value. → _pico8 is forced at 30fps; calculate time by incrementing a variable in `_update` by 1/30._ ## Debug Library -
josefnpat revised this gist
Oct 15, 2015 . 1 changed file with 18 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,17 +6,17 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua ## General * anything written in uppercase the PICO-8 editor or .p8 is made lowercase by the editor. → _editing the .p8 file directly can work__ * multi line comments don't work correctly. → _use single lines to get around this_ * `print(function() end)` segfaults → _(wrapping it in a `tostring` will fix it)_ * `print` takes three arguments (string,x,y) * PICO-8's Lua supports a few [Compound assignment operators](https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Compound_assignment_operators): `+=`,`-=`,`*=`,`/=`,`%=` * PICO-8's Lua has single line shorthand for if then else operators. → _Compare to ternary?: PICO-8 Lua: `IF (NOT B) THEN I=1 J=2 END` vs Lua: `i,j = not b and 1,j or i,2`._ * PICO-8's Lua has a different precision (16:16 fixed point) vs Lua's double-precision floating-point. * PICO-8's Lua has additional Comparison operators/relational operators for "Not Equal To" (`~=`): `!=` * `ipairs` does not have the proper indexing and will loop over the first element infinitely . → _use `pairs` instead_ * There is no `io` object. → _There is technically "Cartride Data" that you can use for persistant information_ * `_VERSION` exists, but can't be accessed via the editor. → _It returns `Lua 5.2`._ * `load` has been overwritten with a PICO-8 function. * PICO-8 introduces many other global functions (see [manual](http://www.lexaloffle.com/pico-8.php?page=manual)). * `rawlen` returns small fractions [incorrect value] @@ -36,30 +36,30 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * `string.find` returns small fractions [invalid indexes] * `string.gmatch` does not return a working iterator [broken iterator index] * `string.gsub` does not return the correct index [incorrect second value] * `string.len` returns a rather small fraction [incorrect value] → _use the `#` operator instead_ * `string.[upper|lower]` while both of these functions technically work correctly, because the char table has had the upper case characters removed, it will not work as intended. ## Lua's Table Library * `table.insert(t,o)` does not insert the proper key. → _use `add(t,o)` instead_ * `table.insert(t,p,o)` does not insert the proper key. Attempting to insert beyond table initialization causes an position out of bounds error. * `table.remove(t,p)` removes the correct value, but then assocates every following value with the key before it. → _use `del(t,o)` instead_ ## Lua's Math Library * `math.a[cos|sin|tan][2]` does not work correctly. [Rounding errors?] → _use `atan2` instead of `math.atan2`_ * `math.[floor|ceil]` returns input [incorrect value] → _use `flr` instead_ * `math.[cos|sin]` return zero [incorrect value] → _use `cos()` and `sin()`. Functions take 0..1 instead of 0..PI*2, and `sin()` is inverted._ * `math.tan` does not work correctly. [Rounding errors?] * `math.[cos|sin|tan]h` does not work correctly. [Rounding errors?] * `math.[deg|rad]` return zero [incorrect value] * `math.[exp|log]` does not work correctly [Rounding errors?] * `math.log10` is nil [does not exist] * `math.pow` does not work correctly [returns -maxint] → _use the `^` operator instead_ * `math.modf` returns two zeros [incorrect value] → _use the `%` operator instead_ * `math.sqrt` does not work correctly [Rounding errors?] → _use `sqrt` instead_ * `math.random` does not work correctly [returns zero] → _use `rnd` instead_ * `math.randomseed` cannot be verified until math.random is fixed [dependency issue] → _use `srand` instead_ * `math.frexp` does not return a value [incorrect return type] _but `math.ldexp` works for some reason!_ * `math.huge` is 0.5 [incorrect value and type] * `math.pi` is 5.341e-05 [incorrect value] @@ -71,7 +71,7 @@ You can always view the [manual](http://www.lexaloffle.com/pico-8.php?page=manua * `os.getenv` works correctly, but the editor cannot write upper case characters. * `os.difftime` does not work correctly, but I think that this could be used to get `os.time` to work correctly. * `os.re[name|move]` this probably works, but operates where the binary for `pico8` is located. * `os.clock` doesn't work correctly, but could probably be scaled to the correct value. → _pico8 is forced at 30fps; calculate time by updating a time in `_update`_ ## Debug Library
NewerOlder