Issue #441 invalid

Tables

buss1000 avatarbuss1000 created an issue

I am using Love2d 8.0 I used to use 7.2 and now my code seems to not work. I have this in a function in a different file called blocks.lua

function defineslots
s1 = { x=64, y=64, t=0}
end

in main in a nutshell I have

function love.load()
require "blocks"
defineslots()
end

This give me the error

Syntax error: blocks.lua:2: '(' expected near 's1'

Now I know this mean on line 2 I need the ( near s1 but this makes no sense.

Also I have noticed I can not do require "blocks.lua" if I do it will look for it in block/lua.lua? Why is this?

I would give you the whole code but I don't want to give away my source code for my own reasons.

I can not use my program unless there is a way around this or a fix I do not know of.

Sorry for your time.

Comments (3)

  1. Danny Fritz

    .lua is automatically searched for in lua's require. '.'s are used as directory delimiters in Lua.

    You're missing the function parameter declaration.

    function defineslots()
    s1 = { x=64, y=64, t=0}
    end
    
  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.