Jump to content


MagicCraftMaster's Content

There have been 8 items by MagicCraftMaster (Search limited from 10-February 22)


By content type

See this member's

Sort by                Order  

#256781 Convert String to Table Name

Posted by MagicCraftMaster on 24 July 2016 - 06:48 PM in Ask a Pro

View Postpowerboat9, on 24 July 2016 - 05:32 PM, said:

If you set the variable "line" (without quotes) to the value of the line, do:

_G[line] = {}

Because _G is a table representing all the global variables
Thanks for the help!



#256768 Convert String to Table Name

Posted by MagicCraftMaster on 24 July 2016 - 05:05 PM in Ask a Pro

I am creating an API/Program that takes a file reads it, creates a raw table of every line it read and creates empty tables with names inside the raw table. For example if raw[14] equaled "Commands" I want it to generate a table with that as the name. How can I achieve this? I thank anybody who can help. =)



#242217 Loading File as readable table in one function

Posted by MagicCraftMaster on 02 January 2016 - 09:08 PM in Ask a Pro

View PostLeDark Lua, on 02 January 2016 - 07:32 PM, said:

do you wan't like, an settings API like INI? or something else?

what i want to do is make an API with other functions i am developing that allows a simple config control system aka load, read, write. however i dont know how to do this and i need a premade small set of 3 functions to do this simply called; getTable(file), getData(table, line, type), setData(table, line, file)



#242213 CraftOS 2.0 - Dan's Secret Project

Posted by MagicCraftMaster on 02 January 2016 - 08:46 PM in General

Honestly i would just like to see this added to ComputerCraft especially if it is optional tiny pixels it would unlock so many possibilities. for instance if it is tiny pixel with a new program you could create custom Character sets and game sprites would be a thing. even if this is not intended for computercraft i think it should be a feature for the computers and programmers it would be one of the greatest thing to happen yet. Dan200 please be generous and add this or tiny pixels to your mod. :)



#242203 Loading File as readable table in one function

Posted by MagicCraftMaster on 02 January 2016 - 07:20 PM in Ask a Pro

View PostCreator, on 02 January 2016 - 09:45 AM, said:

To get a table from a file, just read it and the loadstring it:

local file = fs.open( path, "r")
local data = "return "..file.readAll()
file.close()
local t = loadstring(data)
TableOfMine = t()
that is great but how do i read a line and get all data like i asked i need to be able to get all data on a single line after the : symbol. just like mentioned above. also what goes where the "r" is nothing? i am a slight lua noob an am working on getting better



#242165 Loading File as readable table in one function

Posted by MagicCraftMaster on 02 January 2016 - 05:31 AM in Ask a Pro

i am developing my first advanced OS and upgrading it as i go along with fresh scripts and i want to load a config/save file but, i don't know how to use tables and it is complex i need a tiny function to open a file as a table and allow it to be read with my own function by of witch i will need an example this is what i want it to look like:

function getTable(fileName)
--Insert Methods here
--load data after : symbol
end

function getData(tableName, line, dataType)
--Insert Small Method
end

Preferences = getTable("OS/Data")

term.write(getData(Preferences, 5, string)

if someone could write a code that is new and works on CC 1.7.5+ that would be great thanks :)

Edit: i am making a basic OS for personal use later to be improved and maybe released to the public however i requires a config to make and i need it in API form so i can just add "os.loadAPI("configAPI")" that way i can simply create new menus with little effort



#242067 Peripheral Creation

Posted by MagicCraftMaster on 01 January 2016 - 04:44 AM in Peripheral Help and Discussion

I have no idea where to put this so i am putting it on "Ask a Pro" tell me if it needs to be or is moved.

I need a java pro to make a new peripheral mod with some things i would like to see added/combined some things simple some advanced.

Things i want made(fully aware of alternatives)
Peripheral Container - that works unlike the Peripherals++ one
Synthesized Speaker - a speaker with the ability to synthesize a male/female voice in other languages and play music(iron note block)
New ..Computer(Adv) - a computer able to be decorated/customized with items or code or crafting
ETC.

the voice could be an edited version of the synth. function of peripherals++ ;)


if someone would be willing to help that would be great thanks. :)



#239860 [MC 1.7.10][CC 1.75] Peripherals++ v1.3.6, MiscPeripherals reimagined! In...

Posted by MagicCraftMaster on 07 December 2015 - 09:52 PM in Peripherals and Turtle Upgrades

Peripheral Container not allowing peripherals to be added

crafting of any kind wont allow any peripherals to be added to the container and NEI doesn't show the recipes