global int-casting function

This commit is contained in:
minjaesong
2020-04-10 07:54:28 +09:00
parent 4e841c0deb
commit 722a80edaa
2 changed files with 3 additions and 2 deletions

View File

@@ -98,14 +98,14 @@ class VMGUI(val appConfig: LwjglApplicationConfiguration) : ApplicationAdapter()
for y = 0, 359 do
for x = 0, w - 1 do
palnum = 20 * math.floor(y / 30) + math.floor(x / 28)
palnum = 20 * int(y / 30) + int(x / 28)
vm.poke(-(y * w + x + 1) - hwoff, palnum)
end
end
for y = 360, h - 1 do
for x = 0, w - 1 do
palnum = 240 + (x / 35)
palnum = 240 + int(x / 35)
vm.poke(-(y * w + x + 1) - hwoff, palnum)
end
end

View File

@@ -9,6 +9,7 @@ class VMLuaAdapter(val vm: VM) {
init {
lua.load(Firmware(vm))
lua.load("_G.int = function(n) if n > 0 then return math.floor(n) else return math.ceil(n) end end").call()
}
}