Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update table.length, fix doc bug #14

Merged
merged 3 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.vscode/settings.json

# Ignores all files/directories not within src/SFramework
# This allows you to create any necessary test files/folders at the root of SFramework
# without affecting the repo
src/*
!src/SFramework
2 changes: 1 addition & 1 deletion docs/API/Components/SpriteRenderer.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Sets the animation of the SpriteRenderer to the given spritesheet Font asset
self.gameObject.spriteRenderer:SetAnimation(CS.FindAsset("Sprites/Sample/Animations/Idle", "Font"))
```

## SpriteRenderer:SetAnimatinFrameDuration
## SpriteRenderer:SetAnimationFrameDuration
Sets the animation's frame duration of the SpriteRenderer to the given number of game ticks. Keep in mind that there are 60 ticks per second in CraftStudio. So for instance, if you want to play an animation at 5 frames per second then you would divide 60 by 5 to get the number of ticks. The default frame duration is 5 ticks.
### Arguments
- `ticks` - `number` (required) the number of game ticks per frame of the animation
Expand Down
2 changes: 1 addition & 1 deletion docs/API/LUA_Library_Extensions/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ local index = table.indexOf(myTable, 4) --should return 3
```

## table.length
Returns the length of the given table
Returns the length of the given table. This is an alias for `table.getn`
### Arguments
- `t` - `table` (required) the table to get the length of
### Example
Expand Down
6 changes: 1 addition & 5 deletions src/SFramework/LUA Extensions/table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,5 @@ end
@return the length of the table
]]--
function table.length(t)
local count = 0
for k,v in pairs(t) do
count = count + 1
end
return count
return table.getn(t)
end