lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Feb 20, 2020, at 3:43 PM, Michal Kottman <> wrote:

On Thu, Feb 20, 2020, 4:37 PM Clinton Reese <> wrote:
As you can see below, I'm trying to use strsub(string, i) in a little program that is an attempt at building a very simple vm on top of Lua 5.3:.

This is the output that I get:

j10 m20
false is not equal to 'true.'
m20 false
push30 m30 executed.
x35 print.lua
j40 m50
true is equal to 'true.'
lua53: main.lua:34: attempt to call a nil value (local 'strsub')
stack traceback:
        main.lua:34: in main chunk
        [C]: in ?

strsub() does not exist in Lua 5.3. Did you mean to use string.sub()?

A lot of times, people will add things to the top of their file like:

local strsub = string.sub

so that they can use the shorthands later on in their code.