Log In  

edit after 0.2.5e

The cart works fine in local 0.2.5e PICO-8, but uploading to the BBS (i.e. inserting in this post) is still broken. I think the _ENV is being changed to _env still by some processing after upload(?).

earlier post

The following prints out 1 twice on 0.2.5c, but crashes on 0.2.5d with:

runtime error line 10 tab 0
return function_a(_ENV)
attempt to call global 'func_a'
(a nil value)
in func_b line 10 (tab 0)
at line 17 (tab 0)

Cart #rudekiwobu-2 | 2022-12-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Code:

function get_thing()
    return {
        func_a=function(_ENV)
            return 1
        end,
        func_b=function(_ENV)
            return func_a(_ENV)
        end
    }
end

thing=get_thing()

print(thing:func_a())
print(thing:func_b())

Makes some of the OO/class stuff (based on https://www.lexaloffle.com/bbs/?pid=116282) that I've been doing a little limited.

P#122351 2022-12-13 22:12 ( Edited 2022-12-14 21:08)


[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 07:54:45 | 0.008s | Q:12