EasyManuals Logo

Embedded Systems LogiMachine5 Power User Manual

Embedded Systems LogiMachine5 Power
254 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #54 background imageLoading...
Page #54 background image
54
LP scripts
Allows mixing HTML and Lua inside a single file, Lua chunks must be enclosed in <? ?> tags,
closing tag at the end of the document is not required.
Example
Print current date
<!DOCTYPE html>
<html>
<body>Current date is <? write(os.date()) ?></body>
</html>
Available functions:
header(hdr) adds a custom header to the output
getvar(name) returns named GET/POST variable or nil when variable is not set
getvars() - returns all GET/POST variables as Lua table
getcookie(name) returns named cookie contents or nil when cookie is not set
print(...) outputs any number of variables, ending output with CRLF
write(...) similar to print but does not output CRLF at the end
escape(val) escape single/double quotes, less than/greater than characters to HTML
entities
Library package is loaded via require('apps') and provides access to these functions:
all built-in LM functions: alert, log, grp, storage etc
config library
vprint(...) and vprinthex(...) functions to view variable contents in human-readable form
json library
Example
Output multiplication table. Size can be a GET/POST variable in 1..20 range (defaults to 10).
<!DOCTYPE html>
<html>
<body>
<?
size = getvar('size') -- GET/POST variable
size = tonumber(size) or 0 -- convert to number
if size < 1 or 20 < size then
size = 10 -- set to default value if empty or invalid
end
?>
<table border="1" cellpadding="3">
<? for i = 1, size do ?>
<tr>

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Embedded Systems LogiMachine5 Power and is the answer not in the manual?

Embedded Systems LogiMachine5 Power Specifications

General IconGeneral
BrandEmbedded Systems
ModelLogiMachine5 Power
CategoryController
LanguageEnglish