update docs
This commit is contained in:
@@ -8,18 +8,24 @@ print(thisIsNil.what)
|
|||||||
print(thisIsNil.something())
|
print(thisIsNil.something())
|
||||||
```
|
```
|
||||||
|
|
||||||
## Why i'm getting "cannot access field test of userdata<something>" errors?
|
## Why i'm getting "Cannot access field test of userdata<something>" errors?
|
||||||
Because you are trying to access a field in a C# class that doesn't exist.
|
Because you are trying to access a field in a C# class that doesn't exist.
|
||||||
```lua
|
```lua
|
||||||
print(Item.thisDoesntExist)
|
print(Item.thisDoesntExist)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## What is "Attempt to access instance member "Drop" from a static userdata"
|
||||||
|
It means you are trying to access a member that requires an instance to accessed, for example:
|
||||||
|
```lua
|
||||||
|
Item.Drop() -- there's a static global class called Item, but because it's static, you can't call item specific things on it, this will error.
|
||||||
|
Item.ItemList[1].Drop() -- this won't error, it will drop the first item ever created.
|
||||||
|
```
|
||||||
|
|
||||||
## I'm getting a super big error with things related to the C# side
|
## I'm getting a super big error with things related to the C# side
|
||||||
It usually happens when you call something on the C# side and you provide nil inputs, you can get a better idea of it by analyzing the error message and trying to link it your lua code, for example:
|
It usually happens when you call something on the C# side and you provide nil inputs, you can get a better idea of it by analyzing the error message and trying to link it your lua code, for example:
|
||||||
```lua
|
```lua
|
||||||
Game.SendMessage(nil)
|
Game.SendMessage(nil)
|
||||||
```
|
```
|
||||||
|
|
||||||
This will result in
|
This will result in
|
||||||
```
|
```
|
||||||
[LUA ERROR] System.NullReferenceException: Object reference not set to an instance of an object.
|
[LUA ERROR] System.NullReferenceException: Object reference not set to an instance of an object.
|
||||||
@@ -60,12 +66,11 @@ local firstPlayerCharacter = Client.ClientList[1].Character
|
|||||||
|
|
||||||
-- Spawn on the world
|
-- Spawn on the world
|
||||||
Entity.Spawner.AddToSpawnQueue(prefab, firstPlayerCharacter.WorldPosition, nil, nil, function(item)
|
Entity.Spawner.AddToSpawnQueue(prefab, firstPlayerCharacter.WorldPosition, nil, nil, function(item)
|
||||||
print(item .. " Has been spawned.")
|
print(item.Name .. " Has been spawned.")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Spawn inside an inventory
|
-- Spawn inside an inventory
|
||||||
Entity.Spawner.AddToSpawnQueue(prefab, firstPlayerCharacter.Inventory, nil, nil, function(item)
|
Entity.Spawner.AddToSpawnQueue(prefab, firstPlayerCharacter.Inventory, nil, nil, function(item)
|
||||||
print(item .. " Has been spawned.")
|
print(item.Name .. " Has been spawned.")
|
||||||
end)
|
end)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user