String split returns nil error value in lua

I follow the lua doc page when splitting strings, I tried the error myself. For instance,

Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
split("a,b,c", ",") 

returns

stdin:1: attempt to call global 'split' (a nil value)
stack traceback:
stdin:1: in main chunk
[C]: ?

Why is this so?

+3
source share
2 answers

This is not a lua doc page. This is a wiki article explaining the concept of splitting and concatenating strings, rather than any actual functions in Lua. The Lua documentation clearly states that the separation function does not exist. The wiki article explains how to create such a function and / or how such a function can work.

+12
source

The message is clear: you tried to call a global function with a name splitbut not defined.

+1
source

All Articles