-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for multi file projects #8
Comments
could you please teach me how to submit pull requests (have to fork before?)?? ... i have some ideas, i want you to code them and show you, and if you like them merge them my email is like my username, but in gmail |
Yes, you need to make a fork (your copy of the project), edit it and make a pull request when you agree. |
You can do cat lib.lua >> tmp_cart.lua in lua function cat(lib, tmp_cart)
end I will do parsing for use your function each time it see: --import lib.lua in game lua cart. And use --cart tmp_cart.lua for set cart output name. |
for this to work i think we need some info before:
also i suggest to change config variable names from xxx.tic80 to tic80.xxxx instead, going from general to particular, this way is more easier to group/find more future tic80 related variables |
this can be done even with an ms-dos batch! while working a tic80 project with zbs, in parallel, supposing we are in
i am using this and it works flawlesly... question is, how to convert this batch to a zbs lua package, to make it easy for everyone we must know previously:
limitations:
|
Batch work only for window, you need this functions for translate in lua. function string.cmp(str,str2) -- string is egal
if str:len() ~= str2:len() then
return false
end
for ic=1,#str do
if str:byte(ic) ~= str2:byte(ic) then
return false
end
end
return true
end
function getos()
local BinaryFormat = package.cpath:match("%p[\\|/]?%p(%a+)")
if BinaryFormat == "dll" then
return "Windows"
elseif BinaryFormat == "so" then
return "Linux"
elseif BinaryFormat == "dylib" then
return "MacOS"
end
BinaryFormat = nil
return ""
end
function scandir(directory) -- get array of file name
local i, t, popen = 0, {}, io.popen
local pfile
if string.cmp(getos(),"Linux")==true or string.cmp(getos(),"MacOS")==true then
pfile = popen('ls -a "'..directory..'"')
else
pfile = popen('dir '..directory)
end
for filename in pfile:lines() do
i = i + 1
t[i] = filename
end
pfile:close()
return t
end
function is_fileext(path,ext) -- check file extension
local extsize = ext:len()-1
local extstring = path:sub(path:len()-extsize,path:len())
if string.cmp(extstring,ext)==true then
return true
end
return false
end
function is_dir(path)
local f = io.open(path, "r")
local ok, err, code = f:read(1)
f:close()
return code == 21
end
function is_file(path)
local f = io.open(path, "r")
if f~=nil then
f:close()
return true
end
return false
end
function create_file(path)
local fic = io.open(path,"w")
fic:write("")
fic:close()
end
function del_file(path)
if not is_dir(path)==true then
if string.cmp(getos(),"Linux")==true or string.cmp(getos(),"MacOS")==true then
popen('rm '..path)
else
popen('del '..path)
end
end
end
function cat_file(src,out)
if is_file(src)==true and is_file(out)==true then
popen('cat '..src..' >> '..out)
end
end an example local d = scandir('.') -- array of file name
for i=1,#d do
if is_fileext(d[i],'.lua')==true then
-- print only lua file
print(d[i])
end
end note
|
it need to define tic80.libpath in config file |
|
i have a general idea on how this new feature could work, but i am boiling my head since many days in front of my editor trying to figure out how to do this (i suck at programming, augmented with an awful documentation xD )... maybe you know how to do it:
what do you think?.. do you think is possible?, do you have an idea on how to achieve these?... do you like them ? :) |
some resources i could have found: official ZBS plugin documentation (from homepage) = https://studio.zerobrane.com/doc-plugin , there are some info like:
|
some simplifications:
i honestly tried to modify the plugin by myself, but i bumped with lack of documentation... for example there is an |
look at this ... maybe we can use some of the tools mentioned here, some are written in lua: |
you read this discussion in tic80 issues page: nesbox/TIC-80#2668 ... i better keep analisys there and move technical questions here
i have some ideas on how to implement this, i hope they were not so hard, maybe the most practical woule be to let the package do all the work for us everytime, merging project files in a temp thus killing the need for
require()
's also... something like:but you need some way to specify project cart name before: maybe right click on on project > set cart name, or menu project > properties > esit cart name, or whatever (i dont know how, i a not a plugin/package developer nor have experience with zbs)
The text was updated successfully, but these errors were encountered: