strlen and readfrom

This forum allows you to share scripts with other Zeus users. Please do not post bug reports, feature requests or questions to this forum, but rather use it exclusively for posting scripts or for the discussion of scripts that have been posted.
Post Reply
Posts: 5
Joined: Mon Mar 07, 2011 9:11 pm

strlen and readfrom

Post 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?
Site Admin
Posts: 2547
Joined: Fri Aug 13, 2004 5:10 pm

Post 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
Post Reply