Understanding a basic lua concept

Post Reply
Otra
Posts: 1
Joined: Sun Jan 11, 2015 8:36 pm

Understanding a basic lua concept

Post by Otra »

Using scrite: windows 7

1. x=io.read()
2.Print (x)

input = The raaain in spain

input before return or enter is corrected to

The rain in spain ---- return

Result = The raaain in spain

How do i make io.read when using back space before pressing return to accept correction on input

2.In mudlet print is send(" ")

How do i convert lua code for mudlet

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Understanding a basic lua concept

Post by Vadi »


User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Understanding a basic lua concept

Post by SlySven »

Actually print(<something>) is still valid lua - in fact it is the quickest way to display (locally) multiple returns value from another function call. send(<something>) is "something else" in that it sends <something> to the MUD server - I know that is a little surprising. ;)

In the future we intend to more closely follow the standard Lua policy of returning a nil on runtime lua script errors (where the arguments supplied are the right type but the wrong value) together with a second return of an error message as a string. It will take time to do this but in the future if you are getting odd or no results you may like to try using something like "lua print(<mudlet provided function>(arg1, arg2,...))" and seeing the second return value after the first nil.

Post Reply