Jump to content

var name building from string data

2 replies to this topic

#1 Martin2789

  • Members
  • 5 posts

Posted 14 February 2014 - 02:04 PM

i found this but i dont understand it how to use it i want to write a little program to fill the screens at spawn for this i want to use JSON which looks something like this:
{"monitornorth": [{
			"firstline": "John",
			"secline": "Doe",
			"txtcol": "colors.white",
			"backcol": "colors.blue"
Thanks to LBPHacker and this JSON-API i am able to read this data from the server with
I dont want to modify every pc but i will label them is it possible to String concatenate a variable name?
sth. like this?

var varstring = "obj."..os.getComputerLabel().."[1].firstline"
local var = getfenv()[varstring]
But i thinks thats only the "name" of the variable am i right?
Thank you for your time

TL TR: variable build via generated string(os.getComputerLabel())

Edited by Martin2789, 14 February 2014 - 02:04 PM.

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,464 posts

Posted 14 February 2014 - 02:24 PM

local var = obj[os.getComputerLabel()][1].firstLine

#3 Martin2789

  • Members
  • 5 posts

Posted 14 February 2014 - 03:48 PM

Thank you very much works like a charm ;)

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users