Page 1 of 1

strlen and readfrom

Posted: Mon Mar 07, 2011 9:13 pm
by mahub
I have and old version of Zues running lua engine 1.30 and both of these variables work perfectly in the new beta version of zues lua 1.64 neither of these variable work. Can anyone offer and ideas?

Posted: Tue Mar 08, 2011 5:27 am
by jussij
What you are seeing is a change in the Lua language itself. For more details refer to this Lua reference manual.

For example the code below shows the new strlen way of doing things in Lua:

Code: Select all

-- NOTE: get the current word or marked area
local text = macro_tag("$WEX")

if string.len(text) == 0 then
  message("The cursor is not over a word!")
As for the readfrom function, the Lua FAQ says it has been deprecated:
From Lua 4.x to Lua 5.0, most library functions were moved into tables -- for instance, read() and write() now must be accessed from a global table, for instance, as or io.write(). Other functions, such as readfrom(), no longer exist. (io.popen() can be used if supported by your platform.)

Cheers Jussi