egordorichev / neko8 Goto Github PK
View Code? Open in Web Editor NEWFantasy console inspired by pico8, tic80 and liko12, written in c++
Home Page: https://egordorichev.itch.io/neko8
Fantasy console inspired by pico8, tic80 and liko12, written in c++
Home Page: https://egordorichev.itch.io/neko8
use cmd new with a parameter(not lua or asm), crash
new a
[INFO 12:38:40] main.lua:61: neko 8
[INFO 12:38:40] src/carts.lua:613: running cart /neko.n8
[ERROR 12:38:46] error.lua:64: Ooops, we have a bad news...
Please, send this error to @egordorichev.
It is in your clipboard now.
editors/code.lua:741: attempt to index local 'c' (a nil value)
error.lua:39: in function '__index'
editors/code.lua:741: in function 'import'
src/carts.lua:117: in function 'import'
src/commands.lua:290: in function <src/commands.lua:287>
/neko.n8:202: in function 'run_command'
/neko.n8:174: in function 'triggerCallback'
main.lua:253: in function <main.lua:148>
main.lua:421: in function <main.lua:390>
[C]: in function 'xpcall'
Air:neko8 admin$
Error info:
Air:neko8 admin$ love .
[INFO 01:17:21] main.lua:30: neko 8 v0.0.3 kitten
Error: main.lua:2241: bad argument #18 to 'send' (number or boolean expected, got nil)
stack traceback:
[C]: in function 'send'
main.lua:2241: in function 'initPalette'
main.lua:415: in function 'init'
main.lua:35: in function 'load'
main.lua:255: in function <main.lua:245>
[C]: in function 'xpcall'
Air:neko8 admin$
Love2d version: 0.10.1
Platform: MacOS Sierra 10.12.6
I think maybe your love2d version is different from mine, but you have not say which version in use.
You could use a typedef
for doing bytes.
Like typedef bitset<8> byte
which of course will require you to include <bitset.h>
In helpers.hpp
, you return a pointer allocated on the stack, which is unsafe.
C++ allows you to return a pointer to an array from a local scope, but it is undefined behavior to use the memory pointed to by this pointer outside of its local scope.
Also the result
is not allocated, rather it overwrites w1
, also of which the amount of allocated memory is unknown. It could have enough space to concatenate w2
to it, but it probably doesn't, which is a memory violation.
Suggested revision:
char* concat(const char* w1, const char* w2){
char* result = new char[strlen(w1) + strlen(w2)];
strcpy(result, w1);
strcat(result, w2);
return result;
}
And then make sure to delete[]
afterwards, so usage would be like:
char* result = concat(strOne, strTwo);
// Do something with result
delete[] result;
On Mac, do like below:
Error: main.lua:1258: attempt to perform arithmetic on local 'c' (a table value)
stack traceback:
main.lua:1258: in function 'color'
main.lua:1845: in function 'v'
[string "/neko.n8"]:195: in function 'run_command'
[string "/neko.n8"]:166: in function 'triggerCallback'
main.lua:194: in function <main.lua:105>
main.lua:310: in function <main.lua:282>
[C]: in function 'xpcall'
Air:neko8 admin$
Different contributors and collaborators use different formatting style. I'm mainly talking about spaces and tabs. I believe @egordorichev originally used tabs, so this is a note for everyone: use tabs when developing neko8. If you use vim, you can do :set noet
to write tabs instead of 4 (or 2) spaces.
Here's a quote from @egordorichev about formatting.
2 spaces for tab, but use tabs!! If you can, keep your lines shorter then
4280 chars
So if line doesn't fit, (...) [do this:]
function toLongFunctions(
arg, arg2
)
body
end
On iOS the terminal`s prompt(>) and red rect cursor disappeared, can not input anything
the keyboard can display, but can not input anything.
Neko8 is very nice but I can not use it because it uses asm?!? is a tool for hobbyists, passionate and nostalgic, asm is out of measure for a human being. I've been hobbies for many years, but I think it's a good idea to implement a scripting language that is very simple, everyone's reach. Especially trying to simplify the APIs, PICO-8, TIC-80 and LIKO-12 have a big defect... they use LUA as a script language, and it is not the best choice in my opinion. Python is perfect! it would be nice to implement it similarly to Godot Game Engine's GDScript, a middle ground between Python and the old QuickBasic makes Neko8 perfect and increases the spread of the project. Many people want to use these PICO-8 Like Fantasy Consoles, but they give up because of the complexity and lack of proper tutorials and documentation.
Neko8 implements the documentation inside it, this is a nice feature.
Your work is extraordinary, you can make Neko8 the absolute reference for fans, students and all those people who want to learn calmly, and make a project in no time without frustration.
Thanks for your nice job.
Error when run on iOS, but is normal on Mac
It seemed have not require api.lua when OS is iOS
Error
src/neko8.lua:24: attempt to call global 'initApi' (a nil value)
Traceback
src/neko8.lua:24: in function 'init'
main.lua:58: in function 'load'
main.lua:347: in function <main.lua:337>
[C]: in function 'xpcall'
On iOS, the default soft keyboard called with love2d can not use the ESC or CTRL key, we can not launch the Editor. So I add some ugly code directly in the function love.touchpressed(), it can launch the Editor on iOS, see below:
function love.touchpressed()
love.keyboard.setTextInput(true)
touches = love.touch.getTouches()
for i, id in ipairs(touches) do
local x, y = love.touch.getPosition(id)
if x <= 100 and y <= 100 then
handled = false
if neko.cart then
neko.cart = nil
elseif editors.opened then
editors.close()
else
editors.open()
end
end
end
end
While looking at 1aa3387, I noticed that neko8 is replacing \r\n
with \n
, I'm not sure if it's worth implementing, but it should be noted that it is valid in windows to have multiple \r
s before the \n
indicating multiple line breaks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.