Fixed a few bugs

This commit is contained in:
Cooldude2606
2017-11-30 19:15:38 +00:00
parent 95ff205e2a
commit 4efa83edd9
5 changed files with 17 additions and 8 deletions

View File

@@ -24,8 +24,7 @@ error = function(err)
end end
-- loads the stdlib and allows Core Game and Event -- loads the stdlib and allows Core Game and Event
local StdLib = require '/locale/StdLib/load' local Color, Game, Event = require('/locale/StdLib/load'){'Color','Game','Event'}
local Core, Game, Event = StdLib.Core, StdLib.Game, StdLib.Event
-- loads the ExpLib, functions are plased into the lua global -- loads the ExpLib, functions are plased into the lua global
local ExpLib = require 'ExpLib' local ExpLib = require 'ExpLib'

View File

@@ -217,7 +217,7 @@ setmetatable(defines.lightcolor, _mt.lightcolor)
--require 'stdlib/defines/color' --require 'stdlib/defines/color'
local fail_if_missing = require 'game'['fail_if_missing'] local fail_if_missing = require 'game'['fail_if_missing']
Color = {} --luacheck: allow defined top local Color = {} --luacheck: allow defined top
--- Set a value for the alpha channel in the given color table. --- Set a value for the alpha channel in the given color table.
-- `color.a` represents the alpha channel in the given color table. -- `color.a` represents the alpha channel in the given color table.

View File

@@ -2,7 +2,7 @@
-- @module Game -- @module Game
-- @usage local Game = require('stdlib/game') -- @usage local Game = require('stdlib/game')
Game = { --luacheck: allow defined top local Game = { --luacheck: allow defined top
VALID_FILTER = function(v) VALID_FILTER = function(v)
return v and v.valid return v and v.valid
end, end,

View File

@@ -11,7 +11,8 @@ Discord: https://discord.gg/r6dC2uK
StdLib StdLib
This file allow you to only require this one file to return the diffent libarys. This file allow you to only require this one file to return the diffent libarys.
The array returned contains the stdlib modules so there can be decleared after the file require This file will return a function which can be used to access only the part you want.
Pass a table with the names of the objects you want and it will be return in that order
]] ]]
local StdLib = {} local StdLib = {}
@@ -19,8 +20,17 @@ local StdLib = {}
require '/table' require '/table'
require '/string' require '/string'
require '/time' require '/time'
StdLib.Colour = require '/color' StdLib.Color = require '/color'
StdLib.Game = require '/game' StdLib.Game = require '/game'
StdLib.Event = require '/event' StdLib.Event = require '/event'
return StdLib return function(rtn)
local to_return = {}
for _,name in pairs(rtn) do
if StdLib[name] then
table.insert(to_return,StdLib[name])
end
end
test = to_return
return unpack(to_return)
end

View File

@@ -413,7 +413,7 @@ function table.val_to_str(v)
end end
return '"'..string.gsub(v,'"', '\\"' )..'"' return '"'..string.gsub(v,'"', '\\"' )..'"'
else else
return "table" == type( v) and table.tostring(v) or return "table" == type( v) and table.to_string(v) or
"function" == type(v) and '"cant-display-function"' or "function" == type(v) and '"cant-display-function"' or
"userdata" == type(v) and '"cant-display-userdata"' or "userdata" == type(v) and '"cant-display-userdata"' or
tostring(v) tostring(v)