Re: Möan.lua - A simple messagebox system.
Posted: Sun Apr 08, 2018 9:07 pm
Here's a screenshot of a MenuLayout. Inner and outer padding are customizable.
Code: Select all
Error
Syntax error: joycon.lua:7: unexpected symbol near '<'
Traceback
[C]: at 0x7fa82417f230
[C]: in function 'require'
main.lua:3: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
Code: Select all
require("lovesplash/lovesplash")
require("Moan")
joycon = require("joycon")
state = "lovesplash"
function love.draw()
if state == "lovesplash" then
lovesplash.draw()
else if state == "menu" then
Moan.speak("Title", {"Hello world!", "It's me;--Möan.lua"})
end
end
end
function love.update(dt)
if state == "lovesplash" then
lovesplash.update(dt)
if lovesplash.done() then
state = "menu"
end
end
end
function love.keypressed()
if state == "lovesplash" then
lovesplash.stop()
else if state == "exit" then
love.event.quit()
else
end
end
end
function love.mousepressed()
if state == "lovesplash" then
lovesplash.stop()
else if state == "exit" then
love.event.quit()
else
end
end
end
Learn to read error messages. It says "in joycon", the moan library is not the issue. Check for that < operatorTitanor wrote: ↑Sat Jun 30, 2018 6:21 am hey guys i am trying to use moan in my project but when it gets to the message box code it crashes can someone help with this
here is the errorand here is the codeCode: Select all
Error Syntax error: joycon.lua:7: unexpected symbol near '<' Traceback [C]: at 0x7fa82417f230 [C]: in function 'require' main.lua:3: in main chunk [C]: in function 'require' [C]: in function 'xpcall' [C]: in function 'xpcall'
anyways thanks if you can helpCode: Select all
require("lovesplash/lovesplash") require("Moan") joycon = require("joycon") state = "lovesplash" function love.draw() if state == "lovesplash" then lovesplash.draw() else if state == "menu" then Moan.speak("Title", {"Hello world!", "It's me;--Möan.lua"}) end end end function love.update(dt) if state == "lovesplash" then lovesplash.update(dt) if lovesplash.done() then state = "menu" end end end function love.keypressed() if state == "lovesplash" then lovesplash.stop() else if state == "exit" then love.event.quit() else end end end function love.mousepressed() if state == "lovesplash" then lovesplash.stop() else if state == "exit" then love.event.quit() else end end end
Code: Select all
Error
main.lua:10: attempt to call field 'speak' (a nil value)
Traceback
main.lua:10: in function 'draw'
[C]: in function 'xpcall'
That means that the "speak" function of Moan is nil (not a function or doesn't exist). Try browsing the Moan file and search for the "speak" variableTitanor wrote: ↑Sat Jun 30, 2018 8:15 am sorry wrong error log i already deleted the joycon libraryCode: Select all
Error main.lua:10: attempt to call field 'speak' (a nil value) Traceback main.lua:10: in function 'draw' [C]: in function 'xpcall'
I checked it too and Moan.lua declares a global Moan table. OP's Moan.speak call should work as is with the current Moan.lua from the repo.yetneverdone wrote: ↑Sat Jun 30, 2018 8:53 am Actually, aftwr checking the repo. It should be
```
local Moan = require("moan")
```
Not
```
require("moan")
```
Code: Select all
require('Moan')
Moan.speak('Test', { 'test' })