Embbeded code
Embbeded code
I would like to know how the guys that are developing love2d converted a lua file into an unsigned char array with hexadecimal letters separated by commas, for example boot.lua and nogame.lua.
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Embbeded code
Don't know, but something like this should work:
Code: Select all
local data= {}
for line in love.filesystem.lines("code.lua") do
for c in line:gmatch"." do
data[#data+1] = ('%02X, '):format(c:byte())
end
end
data = table.concat(data)
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Embbeded code
Using the file next to it: auto.lua.
Who is online
Users browsing this forum: No registered users and 10 guests