You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when colon is used inside lua code which is defined inside macro, it doesn't work (probably the line gets split as macro parser is not sensitive to lua blocks).
Needs example, there is 7.4 in docs with colons, something similar, using same block of lua inside/outside of macro to verify the bug exists and to debug it (I'm too busy/lazy to write it now).
The text was updated successfully, but these errors were encountered:
This is a simple example to illustrates the issue above:
DEVICE ZXSPECTRUM48
ORG 32768
; three ways to detect length of a file using LUA
; 1. direct LUA (this works)
LUA PASS3
local f = io.open("macro_lua.asm", "rb")
local file_len = f:seek("end")
f.close(f)
print("'macro_lua.asm' is " .. file_len .. " bytes long")
ENDLUA
; 2. LUA inside of macro (this does not work)
MACRO LUA.FileLength1
LUA PASS3
local f = io.open("macro_lua.asm", "rb")
local file_len = f:seek("end")
f.close(f)
print("'macro_lua.asm' is " .. file_len .. " bytes long")
ENDLUA
ENDM
; LUA.FileLength1
; if line above is uncommented, the following error message is generated:
; macro_lua.asm(20): error: [LUA] attempt to call a nil value (global 'seek')
; macro_lua.asm(24): ^ emitted from here
; 3. a temporary work around for the above problem (it works)
MACRO LUA.FileLength2
LUA PASS3
local f = io.open("macro_lua.asm", "rb")
local file_len = f.seek(f, "end") --; explicit call to the class method avoids using colon
f.close(f)
print("'macro_lua.asm' is " .. file_len .. " bytes long")
ENDLUA
ENDM
LUA.FileLength2
(Please note that I assume that the whole of the above snippet of code is residing in a file named macro_lua.asm).
ped7g
removed
the
help wanted
input from new users needed, or simple-enough tasks for new contributors
label
Aug 29, 2024
v1.20.3 all platforms
when colon is used inside lua code which is defined inside macro, it doesn't work (probably the line gets split as macro parser is not sensitive to lua blocks).
Needs example, there is 7.4 in docs with colons, something similar, using same block of lua inside/outside of macro to verify the bug exists and to debug it (I'm too busy/lazy to write it now).
The text was updated successfully, but these errors were encountered: