Log In  

I'm having trouble finding an elegant way of feeding {} bracketed data into sspr! The data isn't of any particular fixed length and if I send it directly it assumes the whole table is the first argument, rather than a series of arguments. is there a quick way to process the numbers so sspr will accept it sanely? thank you

P#69610 2019-11-03 07:56

2

Not out of the box - there is no introspection functions available in pico lua.

I'd recommend a custom unpack function that would stop after x arguments and call sspr, the move on to the next x arguments.

-- unpack a list into an argument list
-- trick from: https://gist.github.com/josefnpat/bfe4aaa5bbb44f572cd0
function munpack(t, from, to)
 local from,to=from or 1,to or #t
 if(from<=to) return t[from], munpack(t, from+1, to)
end

-- data
local data={56,42,16,16,64,64,16,16}
sspr(munpack(data))
P#69614 2019-11-03 11:16

thanks, that works really well :3

P#69617 2019-11-03 14:39

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 14:36:21 | 0.006s | Q:12