Reputation: 4941
I get lua error attempt to call global write (a nil value ) if I try to run this program, How to fix this ?
page = [[
<html>
<head>
<title>Practing Lua</title>
<body>
<a href = "http://lua.org"> LUA</a>
</body>
</html>]]
write(page)
Upvotes: 1
Views: 2338
Reputation: 56371
you may need to include a library file at first ( the command can be found in the documentaries of your software. ) i.e.
dofile(core.app_path() .. "\\strategies\\standard\\include\\helper.lua");
Upvotes: 0
Reputation: 29493
You can't. If write(page)
is supposed to output HTML so it appears with links in different color, images visible etc rather than a marked up text, then write
must be a function that sends the given text to an HTML renderer, such as a web browser. It is likely that code in your book is using the author's library to write to a web browser. If the author's intention is for you to follow the examples in book, the author likely made this library available from the book's website. Dig in the intro of book.
Upvotes: 0
Reputation: 14565
write
isn't a pre-defined global lua function. you're probably looking for io.write
instead?
i suggest reading the lua docs when you're looking for specific functionality from the built-in libraries.
Upvotes: 3