Jump to content

Magic with "attempt to call global" error.


andrius

Recommended Posts

main.Lua file:

function gamemodeResourceLoaded ( res )
    addPickupItem(1, 1, 0, 0, 0)    
end
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), gamemodeResourceLoaded )

ground_items/items_func.Lua file:

function addPickupItem(item, ammount, x, y, z)
	return true
end

meta.xml:

<meta>
	<info author="Andrius" description="None" version="1.0" type="gamemode" />
	
	<script src="main.Lua" type="server" />
	
	<!-- Items -->
	<file src="ground_items/items_func.Lua" type="server" />

</meta>

 

Error on resource start:

[2019-11-05 17:24:45] ERROR: [gamemodes]\simplemode\main.Lua:27: attempt to call global 'addPickupItem' (a nil value)

27 line is: addPickupItem(1, 1, 0, 0, 0)

Can someone explain this magic to me? :D 

function declared, but also it is not or what :/

 

---------------------------------------------------

SOLVED.

It should be

<script src="ground_items/items_func.Lua" type="server" />

NOT <file src="ground_items/items_func.Lua" type="server" />

:D

Edited by andrius
Solved problem
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...